This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: questions regd namespaces
Thank you very much Jeni..
Quoting Jeni Tennison <jeni@jenitennison.com>:
> Hi Subbu,
>
> > 1. Is xmlns treated different from a normal attribute??
>
> Yes. 'xmlns' attributes don't count as attributes as far as the XSLT
> processor is concerned (either on input or output). The XSLT processor
> automatically adds namespace declarations to the output that you
> create based on the namespaces of and the namespace nodes on the
> elements in the result tree.
>
> > 2. In my case how do i output the value of xmlns??
>
> Well, the simplest way is to make sure that your all-centres element
> in the result is in the namespace
> 'http://www.nda-centres.com/namespaces'. The simplest way of doing
> that is to include a namespace declaration on the literal result
> element. For example:
>
> <xsl:template match="/">
> <all-centres xmlns="http://www.nda-centres.com/namespaces" />
> </xsl:template>
>
> But more usually you should declare the namespace on the
> xsl:stylesheet element as the default namespace for the stylesheet:
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns="http://www.nda-centres.com/namespaces">
>
> <xsl:template match="/">
> <all-centres />
> </xsl:template>
>
> </xsl:stylesheet>
>
> > 3. How will someone benifit from using a namespace declaration??
>
> That's a hard question to answer. The namespace of an element is an
> essential part of an element, so it's like asking "How will someone
> benefit from naming an element?" They'll benefit because the element
> will be recognised properly by applications that are built to process
> elements in that namespace. The point of namespaces in general is to
> enable you to have documents that mix elements from lots of different
> markup languages without getting confused about what a particular
> element means.
>
> > 4. In the xsl:stylesheet instruction,
> > <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> > the above namespace allows some XSL functions where as the older
> version
> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> does not
> allow some
> > methods..
> > so where are these methods?? how does the processor know that the
> perticular
> > namespace doesnt contain the method or does contain the method??where
> does it
> > look for this information?
>
> The XSLT processor has the methods (I assume you mean functions and
> elements) built into it. The XSLT processor knows which elements and
> functions it needs to use based on the namespace URI, which is
> hard-coded into the processor. The XSLT processor doesn't need to look
> anywhere to find this information -- it is programmed in by the
> implementer; the implementer found out what functions and elements
> need to be supported by reading the spec.
>
> Cheers,
>
> Jeni
>
> ---
> Jeni Tennison
> http://www.jenitennison.com/
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
>
--------------------------------------------------------------
Sent with "Me-Mail", Boltblue's FREE mobile messaging service.
http://www.boltblue.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list