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

[XML Schema 1.1] The XPath in <assert> cannot "look up" the XML tree, right?

From: Costello, Roger L. <costello@mitre.org>
Date: Wed, 29 Apr 2009 09:35:35 -0400
To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
Message-ID: <9E51F88D5247B648908850C35A3BBB5003F245AA95@IMCMBX3.MITRE.ORG>
[XML Schema 1.1] The XPath in <assert> cannot "look up" the XML  tree

Hi Folks,

I wish to confirm that I correctly understand the specification. I believe it says the XPath in an <assert> cannot "look up" the XML tree. That is, it can't reference a parent, grandparent, etc. Is that correct?

Consider this instance document:

<Document classification="secret">
    <Para classification="unclassified">
          ...
    </Para>
    <Para classification="secret">
          ...
    </Para>
    <Para classification="unclassified">
          ...
    </Para>
    <Para classification="secret">
          ...
    </Para>
</Document>


Here I place an <assert> on the Para element which attempts to reference the (parent) Document element:

<xs:element name="Para">
    <xs:complexType>
        <xs:simpleContent>
            <xs:extension base="paraType">
                <xs:attribute name="classification" type="classificationLevels" use="required"/>
                <xs:assert test="if (@classification eq 'top-secret') then ../Document/@classification eq 'top-secret') ... />
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
</xs:element>

This is not allowed, correct?

/Roger
Received on Wednesday, 29 April 2009 13:36:12 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

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-2007 All Rights Reserved.