XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] 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]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS