Subject: Possible transformiix bug with defaulted attributes. From: MarkH@xxxxxxxx Date: Thu, 4 May 2000 12:49:37 +0100 |
I have different behaviour between Transformiix and MSXML XSL processors and think that MSXML is the one which is behaving correctly. Before I rush off and report this as a bug, I'd appreciate some verification. The problem arises out of conditional match against a missing attribute where the XML schema provides a default value. Where the attribute is present, both MSXML and Transformiix XSL processors behave identically, but where the attribute is missing only MSXML v3 appears to perform correctly, by substituting the default value as specified in the schema. I have included minimal schema, xml data and xsl files below to illustrate the problem. The difference in parsers is as follows: >>>> MSXML v3.0 produces: <EveryThing> <SubObject group="0" name="first"/> <SubObject group="1" name="second"/> </EveryThing> >>>> Transformiix 1.0 [beta v20000222] (Mozilla XSL processor) produces: <?xml version="1.0"?> <EveryThing> <SubObject group="1" name="second"/> </EveryThing> ==8<=== SCHEMA FILE: http://www.agilic.com/testschemas/DefaultTestSchema.xml <?xml version="1.0"?> <Schema name="DefaultTestObject" xmlns="urn:schemas-microsoft-com:xml-data" xmlns:dt="urn:schemas-microsoft-com:datatypes"> <ElementType name="RootObject" content="eltOnly" order="many" model="closed"> <element type="SubObject" minOccurs="0"/> </ElementType> <ElementType name="SubObject"> <AttributeType name="name" dt:type="string" required="no" default="" /> <AttributeType name="someAttribute" dt:type="boolean" required="no" default="0" /> <attribute type="name" /> <attribute type="someAttribute" /> </ElementType> </Schema> ==8<=== XML FILE: http://www.agilic.com/testschemas/DefaultTest.xml <?xml version="1.0"?> <RootObject xmlns="x-schema:http://www.agilic.com/testschemas/DefaultTestSchema.xml"> <SubObject name="first"/> <SubObject name="second" someAttribute="1"/> </RootObject> ==8<=== XSL FILE: http://www.agilic.com/testschemas/DefaultTest.xsl <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" indent="yes" omit-xml-declaration="yes" /> <xsl:template match="/"> <xsl:apply-templates /> </xsl:template> <xsl:template match="RootObject"> <xsl:element name="EveryThing"> <xsl:for-each select="//SubObject[@someAttribute = 0]"> <xsl:element name="SubObject"> <xsl:attribute name="group">0</xsl:attribute> <xsl:attribute name="name"><xsl:value-of select="@name" /></xsl:attribute> </xsl:element> </xsl:for-each> <xsl:for-each select="//SubObject[@someAttribute = 1]"> <xsl:element name="SubObject"> <xsl:attribute name="group">1</xsl:attribute> <xsl:attribute name="name"><xsl:value-of select="@name" /></xsl:attribute> </xsl:element> </xsl:for-each> </xsl:element> </xsl:template> </xsl:stylesheet> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Multiple output for one XML Fil, Franz-Josef Herpers | Thread | Re: Possible transformiix bug with , David Carlisle |
Re: get the value from a different , Nicola Cubeddu | Date | Re: get the value from a different , Nicola Cubeddu |
Month |