[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XSLT 2 processing of W3C Schema expressed default

Subject: RE: XSLT 2 processing of W3C Schema expressed default attributes
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 2 Sep 2003 17:50:34 +0100
xmlns default
Saxon is not (yet) a schema-aware processor: it takes its input from the
infoset, not from the PSVI. So it doesn't know anything about defaults
in the schema. There might be a way of invoking Saxon using (say) Xerces
in such a way that the defaults are expanded, but I'm not aware of it.

This raises an interesting point about the spec. Technically, everything
to do with construction of the source tree is outside the conformance
boundary. But in the discussion of the processing model, we probably
ought at least to mention that a schema-aware processor is more likely
to use the PSVI-to-datamodel mapping (and therefore to expand
schema-specified defaults) whereas a non-schema-aware processor is more
likely to use the infoset-to-datamodel mapping (and therefore to not
expand them).

Michael Kay


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> G. Ken Holman
> Sent: 02 September 2003 16:24
> To: XSL List
> Subject:  XSLT 2 processing of W3C Schema expressed 
> default attributes
> 
> 
> 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>
> 
> 
> --
> Next public European delivery:  3-day XSLT/2-day XSL-FO 
> 2003-09-22 Instructor-led on-site corporate, government & 
> user group training for XSLT and XSL-FO world-wide:  please 
> contact us for the details
> 
> 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
> 


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.