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

Re: XPath 2.0 Best Practice: wrap the first node of ev

Subject: Re: XPath 2.0 Best Practice: wrap the first node of every path expression within schema-element?
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Tue, 25 Mar 2008 18:02:40 +0100
Re:  XPath 2.0 Best Practice: wrap the first node of ev
Costello, Roger L. wrote:

Apparently, from what Martin states, AltovaXML is schema-aware but
would not generate an error or a warning on the above examples.
(Martin, can you confirm this?)

Yes, so far I have not been able to get AltovaXML to report errors or warnings on misspelled or not existing elements, even when the input document had been validated.


My test document is

<Book
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="test2008032101Xsd.xml">

  <Author>
    <LastName>Kay</LastName>
    <FirstName>Michael</FirstName>
  </Author>

</Book>

where the schema file looks like this

<xs:schema
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  version="1.0">

  <xs:element name="Book">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Author" maxOccurs="unbounded">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="LastName" type="xs:string"/>
              <xs:element name="FirstName" type="xs:string"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

</xs:schema>

and the XSLT stylesheet looks like this:

<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="2.0">

<xsl:import-schema schema-location="test2008032101Xsd.xml"/>

<xsl:template match="/schema-element(Book)">
<xsl:text>matching on schema type: </xsl:text>
<xsl:value-of select="(Author/LastName, Author/Foo, Author/LastNam, Author/Firstname)"/>
</xsl:template>


</xsl:stylesheet>

then I run it like this

AltovaXML.exe /xslt2 test2008032101Xsl.xml /in test2008032101.xml

and the output is

<?xml version="1.0" encoding="UTF-8"?>matching on schema type: Kay

so it applies the template matching on schema-element(Book) but it does not give any warnings on Author/Foo, Author/LastNam, Author/Firstname.



--

	Martin Honnen
	http://JavaScript.FAQTs.com/

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