[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Identity transform (case conversion)
Hi Dimitre, Please read my comments below.. On 7/9/06, Dimitre Novatchev <dnovatchev@xxxxxxxxx> wrote: It would really be a nasty bug, in case Mukul got that output.
<xsl:template match="*"> <xsl:element name="{translate(name(), $small, $caps)}"> <xsl:variable name="nsHolder"> <test> <xsl:for-each select="namespace::*"> <xsl:attribute name="{name()}:dummy{position()}" namespace="{.}"></xsl:attribute> </xsl:for-each> </test> </xsl:variable> <xsl:copy-of select="msxsl:node-set($nsHolder)/test/namespace::*"/> <xsl:apply-templates select="@*"/> <xsl:apply-templates/> </xsl:element> </xsl:template> I get output: <?xml version="1.0" encoding="UTF-8"?> <!-- THIS IS A COMMENT --> <?PQR X="DO-SOMETHING" ?> <AUTHOR xmlns:auto-ns1="http://www.w3.org/XML/1998/namespace" xmlns:a="xyz" xmln s:b="pqr"> <PERSON A:AGE="30" xmlns:A="XYZ"> BY <FIRSTNAME>JANE</FIRSTNAME> <LASTNAME>DOE</LASTNAME>, </PERSON> </AUTHOR> But when I write the code as (I have now done filtering for namespaces, with name() = 'xml'): <xsl:template match="*"> <xsl:element name="{translate(name(), $small, $caps)}"> <xsl:variable name="nsHolder"> <test> <xsl:for-each select="namespace::*[not(name() = 'xml')]"> <xsl:attribute name="{name()}:dummy{position()}" namespace="{.}"></xsl:attribute> </xsl:for-each> </test> </xsl:variable> <xsl:copy-of select="msxsl:node-set($nsHolder)/test/namespace::*"/> <xsl:apply-templates select="@*"/> <xsl:apply-templates/> </xsl:element> </xsl:template> I get output: <?xml version="1.0" encoding="UTF-8"?> <!-- THIS IS A COMMENT --> <?PQR X="DO-SOMETHING" ?> <AUTHOR xmlns:a="xyz" xmlns:b="pqr"> <PERSON A:AGE="30" xmlns:A="XYZ"> BY <FIRSTNAME>JANE</FIRSTNAME> <LASTNAME>DOE</LASTNAME>, </PERSON> </AUTHOR> i.e., now the namespace http://www.w3.org/XML/1998/namespace is not getting generated, which I think implies that it is bound to the 'xml' prefix. But with the earlier code, URI http://www.w3.org/XML/1998/namespace is bound to the prefix auto-ns1. There seems to be a bug somewhere within MSXML4 related to this.. I have tested George's code as well (the <dummy/> example he gave), with MSXML4. I get the same output as he is getting. So MSXML4 is generating the namespace http://www.w3.org/XML/1998/namespace bound to prefix 'xml'. Regards, Mukul
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|