Stage 3: Adding a Schema


Stage 3: Adding a Schema

The output that an XSLT 2.0 stylesheet produces for a given source document can change if you validate the source document before transforming it. This section lists some of the changes that might occur:

  • Processing a source document using a schema will cause attribute nodes with defaulted values to be added to the tree, and will cause element nodes with defaulted values to acquire a value. These extra nodes will be visible to the XSLT stylesheet.

  • Because data is now typed rather than untyped, errors may be reported . For example if an attribute birthDate is defined in the schema to have type xs:date , then the expression «substring (@birthDate, 1, 4) » will fail with a type error, because the substring() function can be applied only to a string. The remedy is to convert the value to a string explicitly, using the string() function or a cast.

  • The results of comparisons may change. The most noticeable effect will be with list-valued elements and attributes, where a comparison (using «= » or any of the other general comparison operators) now tests each item in the list of values independently, rather than testing the string value of the containing node as a whole.

  • The results of sorting may change. For example, if the sort key has type «xs:dayTime Duration » , then the values will be compared as durations, not as strings.




XSLT 2.0 Programmer's Reference
NetBeansв„ў IDE Field Guide: Developing Desktop, Web, Enterprise, and Mobile Applications (2nd Edition)
ISBN: 764569090
EAN: 2147483647
Year: 2003
Pages: 324

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net