OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Namespace prefixes



At 11:54 PM -0700 2001-08-08, Tom Bradford wrote:
>ReemaD@riskinc.com wrote:
>>      I have some doubts on using prefixes in Namespaces.From the following
>> mentioned site
>> http://www.rpbourret.com/xml/NamespacesFAQ.htm
>> 
>> I found out that prefixes are not significant. But it doesn't work out in
>> my application when i replace xsl prefix with any arbitrary name like abc.


Note "xsl":                      ^^^

It sounds as if your application is written in XSLT.  If so, at
least the way most XSLT applications are configured, the "xsl:"
prefix is important.  Most (all?) XSLT processors associate "xsl:"
with the XSLT namespace by default.  See section 2.1 of the XSLT
recommendation at (http://www.w3.org/TR/xslt#xslt-namespace) for
details, specifically:

    The XSLT namespace has the URI http://www.w3.org/1999/XSL/Transform.

and

    This specification uses a prefix of xsl: for referring to
    elements in the XSLT namespace. However, XSLT stylesheets are
    free to use any prefix, provided that there is a namespace
    declaration that binds the prefix to the URI of the XSLT
    namespace.

If you are going to use "abc:" (or anything else) instead of 
"xsl:" for the prefix for XSLT elements in an XSLT application, 
you'll need to start your stylesheet with 

    <abc:stylesheet version="1.0"
        xmlns:abc="http://www.w3.org/1999/XSL/Transform">

instead of

    <xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

However, unless you have a good reason to use something other than 
the "xsl:" prefix for the XSLT elements, you'll be better off if 
you stick with "xsl:" -- no reason to confuse anyone who might 
need to modify or maintain your applications or reuse portions 
of them. 


/s/ Ernest G. Allen



>> 
>> So i am confused whether xsl prefix has any significance or not. If anybody
>> has tried this then please help me out.
>
>Prefixes are insignificant as far as the tools that you use to process a
>document are concerned.  They don't care what the prefix is, only what
>the namespace URI is.  But, within the document itself, the prefix is a
>shorthand for associating the namespace URI with an element or
>attribute, so if you change the prefix that's associated with the
>namespace URI, you need to change it everywhere for that context.  So it
>doesn't matter what prefix you use, although it is common to use a
>well-known prefix for clarity.
>
>-- 
>Tom Bradford --- The dbXML Project --- http://www.dbxml.org/
>We store your XML data a hell of a lot better than /dev/null
>
>------------------------------------------------------------------
>The xml-dev list is sponsored by XML.org <http://www.xml.org>, an initiative of OASIS <http://www.oasis-open.org>
>
>The list archives are at http://lists.xml.org/archives/xml-dev/
>
>To unsubscribe from this elist send a message with the single word
>"unsubscribe" in the body to: xml-dev-request@lists.xml.org