Subject: RE: [xsl] namespace generation in the output. From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Tue, 31 May 2005 23:16:00 +0100 |
> Then I found this in the docbook stylesheets :-) > > > <xsl:element name="xsl:stylesheet"> > <xsl:variable name="a"> > <xsl:element name="dummy" > namespace="http://www.w3.org/1999/xhtml"/> > </xsl:variable> > <xsl:copy> > <xsl:copy-of select="exsl:node-set($a)//namespace::*"/> > <xsl:copy-of select="@*"/> > <xsl:apply-templates/> > </xsl:copy> > </xsl:template> > > > which simply copies over the namespace from the variable just > declared, > which means that the stylesheet produced puts all literal content into > the xhtml namespace. No, it doesn't put elements into the XHTML namespace: it causes the XHTML namespace to be declared in the output even if it is never used. As DC mentioned this trick is usually needed only when the required namespace is not known until run-time. In other cases you can use a literal result element and all its in-scope namespaces will be copied with it. This example is unusual because it's using xsl:element rather than an LRE. This is because you can't generate an xsl:stylesheet element using an LRE unless you go through all the complexities of xsl:namespace-alias, which this developer was wise to avoid. Michael Kay http://www.saxonica.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] namespace generation in t, David Carlisle | Thread | [xsl] Extreme 2005 Program Now Avai, B. Tommie Usdin |
Re: [xsl] xsl:number and conditiona, Bruce D'Arcus | Date | RE: [xsl] xsl:number and conditiona, Michael Kay |
Month |