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

Re: XML Schema Design: no local elements with anonymoustypes

  • From: Jonathan Robie <jonathan.robie@r...>
  • To: "Costello, Roger L." <costello@m...>
  • Date: Wed, 26 Mar 2008 11:24:36 -0400

Re:  XML Schema Design: no local elements with anonymoustypes
Costello, Roger L. wrote:
> Here's why: XSLT/XPath 2.0 is "schema-aware."  That is, in a 2.0
> stylesheet you can take advantages of the type information in the
> schema.  However, that's true only if the elements are declared
> globally and/or with a named type.  So, to facilitate the use of type
> information by a 2.0 stylesheet, design your XML Schemas such that
> elements are declared globally and/or with a named type.
>   
This is not true as written.

XPath 2.0 is schema aware for anonymous types too, and leverages such 
types appropriately for operators, including comparisons. What you can 
not do is refer to such a type by name. Of course, you can refer to a 
base type. So you could use tests like:

element(NumPages, xs:integer)
element(NumPages, xs:positiveInteger)

But of course you can't match the anonymous type directly, because it 
has no name, you can only match against its base types or against the 
element name. But in many cases this is sufficient - would you really 
use the full derived type to make decisions on how to format this 
particular integer? You'd be more likely to use the element name, its 
position in the document, and perhaps the fact that it is a positive 
integer.

To me, it's good to use named types if:

1. The type will be used in more than one place.
2. The type has a meaningful identity that can affect the way it is 
processed.

Jonathan


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.