Subject: [xsl] namespace declarations in generated stylesheet From: "Mike Haarman" <mhaarman@xxxxxxxxxxxxxxxxxx> Date: Fri, 11 Apr 2003 12:52:29 -0500 |
Hey all, I have noticed a remarkable discrepancy between the behavior of Saxon and Xalan over the following stylesheet and instance: -------------------------------------------------------------------------------- -------- <?xml version="1.0" encoding="utf-8"?> <my:document xmlns:my="http://www.my.net/MyMarkup"> <element status="current" name="report"/> </my:document> -------------------------------------------------------------------------------- -------- <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:fox="http://xml.apache.org/fop/extensions" xmlns:my="http://www.my.net/MyMarkup" > <xsl:output method="xml" encoding="utf-8"/> <xsl:template match="/"> <xsl:element name="xsl:stylesheet"> <xsl:element name="xsl:param"> <xsl:attribute name="name"> <xsl:text>report.style</xsl:text> </xsl:attribute> <xsl:attribute name="select"> <xsl:text>/root/param[@name = 'style']/@value</xsl:text> </xsl:attribute> </xsl:element> </xsl:element> <xsl:apply-templates/> </xsl:template> </xsl:stylesheet> In generating the xsl:stylesheet declaration in the result, Saxon won't allow me to declare anything other than xslns:xsl and this it does for me. Xalan also won't let me change it but returns all the namespaces declared on the stylesheet generating the output. Saxon output: -------------------------------------------------------------------------------- -------- <?xml version="1.0" encoding="utf-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="report.style" select="/root/param[@name = 'style']/@value"/></xsl:stylesheet> Xalan output: -------------------------------------------------------------------------------- -------- <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:my="http://www.my.net/MyMarkup" xmlns:fox="http://xml.apache.org/fop/extensions" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="report.style" select="/root/param[@name = 'style']/@value"/></xsl:stylesheet> The question is, who's right? What behavior should I be expecting? I thought I ought to be able to just whip up a set of namespace declarations with something like: <xsl:element name="xsl:stylesheet"> <xsl:attribute name="xmlns:my"> <xsl:text>http://www.my.net/my markup</xsl:text> </xsl:attribute> </xsl:element> But that don't work for either tool and I think I am just beginning to see why. Can anyone enlighten me? Much obliged, Mike Haarman XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Bizarre problem with MSXM, Kovach, Dave | Thread | RE: [xsl] namespace declarations in, Michael Kay |
Re: [xsl] How to render TEI <div*>s, Wendell Piez | Date | Re: [xsl] Using XSLT within VB.net?, mmbradley |
Month |