xsl-list
[Top] [All Lists]

Attribute's default value in xsd doesn't show in xslt

2003-05-28 18:03:26
Can someone please explain to me how come the default value I have set in
abc.xsd doesn't get into the abc.xslt? If I understand it correctly, I should
get a result text file of 'bbbbb' but it comes out empty. If I use abc2.xml
I get 'aaaaa' which shows the example works but not the default value.

Thanks!

EL



abc.xsd
----------------------------
<?xml version="1.0" ?>
<xs:schema id="abc" targetNamespace="abc" xmlns:omm="abc" 
xmlns:xs="http://www.w3.org/2001/XMLSchema";
version="1.0">
        <xs:element name="structure">
                <xs:complexType>
                        <xs:attribute name="defaultValue" type="xs:string" 
use="optional" default="bbbbb"
/>
                </xs:complexType>
        </xs:element>
</xs:schema>


abc.xslt
----------------------------
<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns="http://www.w3.org/1999/XSL/Transform";
    xmlns:omm="abc">
    
<xsl:output method="text" />

<!-- MAIN -->

<xsl:template match="/">
        <xsl:apply-templates select="omm:structure" />
</xsl:template>

<!-- HEADER -->

<xsl:template match="omm:structure">
<xsl:value-of select="@defaultValue" />
</xsl:template>

</xsl:stylesheet>


abc.xml
----------------------------

<?xml version="1.0" encoding="utf-8" ?>
<structure xmlns="abc">
</structure>


abc2.xml
----------------------------
<?xml version="1.0" encoding="utf-8" ?>
<structure xmlns="abc" defaultValue="aaaaa">
</structure>



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list