[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] namespace generation in the output.
Subject: [xsl] namespace generation in the output. From: Dave Pawson <davep@xxxxxxxxxxxxx> Date: Tue, 31 May 2005 18:59:15 +0100 |
Problem. I was writing a stylesheet to produce another stylesheet. I wanted all elements output from the second stylesheet, which were literal content to be in a specific namespace I knew the docbook stylesheets did this to produce xhtml, and yet Saxon kept finding out I was cheating! <xsl:element name="xsl:stylesheet"> etc when I tried any variant of <xsl:attribute name="xslns"> .... Saxon realised what I was doing and (correctly) told me not to. 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. I thought it a clever way to achieve what is now doable in xslt 2.0 (I'm sure MK or DC will tell us how :-) This is an xslt 1.0 solution. -- Regards, Dave Pawson XSLT + Docbook FAQ http://www.dpawson.co.uk
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] preceding-sibling:: while, Spencer Tickner | Thread | RE: [xsl] namespace generation in t, Michael Kay |
Re: [xsl] preceding-sibling:: while, Spencer Tickner | Date | Re: [xsl] preceding axis and contex, Wendell Piez |
Month |