Subject: [xsl] ug in MSXML3: An element has two attributes with the same name -- DTD default not overriden From: Dimitre Novatchev <dnovatchev@xxxxxxxxx> Date: Thu, 18 Jan 2001 12:20:06 -0800 (PST) |
As promised earlier today, here's some information about this bug, that may be useful to stylesheet authors using MSXML3. xml source1: ------------- <?xml version="1.0" ?> <!DOCTYPE gifts [ <!ENTITY nbsp " "> <!ELEMENT gifts (ModelNumber+)> <!ELEMENT ModelNumber (#PCDATA)> <!ATTLIST ModelNumber group (gold | red) "red" dep (gold | red) "red" prod (gold | red) "red" location CDATA #IMPLIED ref CDATA #IMPLIED id ID #IMPLIED > ]> <gifts> <ModelNumber prod="gold">P6205</ModelNumber> </gifts> The stylesheet: ---------------- <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" omit-xml-declaration="yes"/> <xsl:template match="/"> <xsl:for-each select="/gifts/ModelNumber/@*"> <xsl:value-of select="name()"/> <xsl:text>
</xsl:text> </xsl:for-each> </xsl:template> </xsl:stylesheet> Result: ------- prod group dep prod Note the two attriute with the name "prod" !!!! Saxon produces: ----------------- prod group dep MSXML3 July Beta rel. produces: ------------------------------------ prod group dep Another result of this bug -- let's apply the identity transformation, as defined in the XSLT spec to the same xml doc: The stylesheet: ---------------- <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" omit-xml-declaration="yes"/> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> Result: -------- <gifts> <ModelNumber prod="red" group="red" dep="red">P6205</ModelNumber> </gifts> As you can see here, the problem is that the default value for @prod ("red")from the DTD was used by MSXML3 to override the value ("gold") that was in fact specified in the xml document !!! Saxon produces: ------------------ <gifts> <ModelNumber prod="gold" group="red" dep="red">P6205</ModelNumber> </gifts> MSXML3 July Beta rel. produces: -------------------------------------- <gifts> <ModelNumber prod="gold" group="red" dep="red">P6205</ModelNumber> </gifts> Cheers, Dimitre Novatchev. __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] RE: Determining the level, Michael Kay | Thread | [no subject], by way of B. Tommie |
Re: [xsl] the nearest ancestor with, G. Ken Holman | Date | Re: [xsl] A neophyte Q, Walter Torres |
Month |