|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XSLT 2 processing of W3C Schema expressed default attr
Hi folks!
My expectations of the instance and document model below are that a schema-aware XSLT 2 processor will "see" the default attribute expressed in the W3C Schema expression and this attribute will show up in a copy-of for the entire document. I'm expecting the output <entry1> will have defattr="hello" included since I didn't specify such an attribute in the input. The output running Saxon 7.6.5 doesn't show the default attribute and the documentation at http://saxon.sourceforge.net/saxon7.6.5/index.html doesn't discuss the PSVI, so I'm assuming I've messed up somewhere in the specification of the schema model ... but cannot see it in this simple example. Can someone point me to where my mistake is and to which collection of XSLT 2 processors I can work with to see these default attributes? Thanks for your help! .................. Ken V:\samp>type defattr.xml <?xml version="1.0" encoding="iso-8859-1"?> <doc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="defattr.wxd"> <entry1>AB</entry1> <entry2 attr="CD"/> </doc> V:\samp>type defattr.wxd <?xml version="1.0" encoding="iso-8859-1"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="doc">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="entry1">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="codelist">
<xsd:attribute name="defattr" type="xsd:string" use="optional"
default="hello"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="entry2">
<xsd:complexType>
<xsd:attribute name="attr" type="codelist"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element><xsd:simpleType name="codelist">
<xsd:restriction base="xsd:normalizedString">
<xsd:enumeration value="AB"/>
<xsd:enumeration value="CD"/>
</xsd:restriction>
</xsd:simpleType></xsd:schema> V:\samp>msv defattr.wxd defattr.xml No validation errors. V:\samp>type copyofall2.xsl
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0"><xsl:template match="/"> <xsl:copy-of select="."/> </xsl:template> </xsl:stylesheet> V:\samp>xslt2 defattr.xml copyofall2.xsl con <?xml version="1.0" encoding="UTF-8"?><doc xsi:noNamespaceSchemaLocation="defatt r.wxd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <entry1>AB</entry1> <entry2 attr="CD"/> </doc> V:\samp>
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) ISBN 0-13-065196-6 Definitive XSLT and XPath ISBN 0-13-140374-5 Definitive XSL-FO ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath ISBN 1-894049-11-X Practical Formatting Using XSL-FO Member of the XML Guild of Practitioners: http://XMLGuild.info Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|

Cart








