XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Is there any legitimate case for processing based on a specific namespace prefix?

At 2012-08-28 20:20 +0000, Costello, Roger L. wrote:
>Hi Folks,
>
>Recall that a namespace prefix may be anything.
>
>For example, by convention 'xsl' is used as the prefix for the XSLT 
>namespace, but I could equally well use 'foo' or 'bar' as the prefix.
>
>Is there ever a time when it is okay to create an XML application 
>that checks for a specific prefix, e.g.,
>
>     If the prefix is 'foo' then
>             do A, B, C
>      Else
>            do X, Y, Z

Not that I can think of.

>It seems to me that such code would be very brittle and very unwise.

I agree.

>But perhaps there are legitimate cases where this is okay.
>
>If so, would you provide a concrete example please?

The only time I found it necessary was when dealing with an 
application that was incorrectly hardwired to a prefix.  While not 
true any more, there was a time when a particular XSL-FO processor 
was hardwired to expect <fo:block>.  My practice is to use the 
default namespace and <block>.  For one client I had to change my 
practice because of the non-conformant behaviour of his choice of software.

Another client asked me to use <fo:block> because that is what his 
staff had been trained to expect, thus anything else wasn't expected 
to be as maintainable.

Some students tell me they prefer <fo:block> for readability.  But I 
think it is just what you are used to and I personally like <block> 
because it "feels" more like using HTML.

When I write UBL instances I use no prefix for the document element 
and I use the committee's choice of prefix ("cac" and "cbc") for all 
other elements ... but just for the benefit of those who might be 
thrown by seeing "foo" and "bar".

So I think your answer is "when dealing only with software, the 
prefix doesn't matter, but when dealing with people, the prefix might 
very well matter (but not for software reasons)".

As a convention, when I'm using XSLT 2.0 to write XSLT, I'll use 
<xsl:> for instructions and <xslo:> for the result tree ... the 
processor outputs <xsl:>.  Back when using XSLT 1.0 I would use 
<xst:> for instructions and <xsl:> for the result tree so that the 
processor would output <xsl:>.

I hope this helps.

. . . . . . . . . . . Ken

--
Public XSLT, XSL-FO, UBL and code list classes in Europe -- Oct 2012
Contact us for world-wide XML consulting and instructor-led training
Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/x/
G. Ken Holman                   mailto:gkholman@CraneSoftwrights.com
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS