[xsl] XSLT 2 and Invalid documents

Subject: [xsl] XSLT 2 and Invalid documents
From: Elliotte Rusty Harold <elharo@xxxxxxxxxxxxxxx>
Date: Sat, 15 Feb 2003 08:14:38 -0500
What happens in XSLT 2 when a schema is applied to assign types and the document is invalid, either a little or a lot? Does the transformation fail? Or does it proceed with whatever information it has been able to deduce from the document and its schema? What if the processor has been able to assign types to some elements and not to others? And in general, how does the calculation of a PSVI depend on validity?

Practical example:

<product>
  <quantity>1</quantity>
</product>

Suppose product is declared to have two required child elements, name and quantity. name is declared to be a string. quantity is declared to be an int. When the processor reads the above document, will it still assign the type int to the quantity element? What about this case:

<product>
  <quantity>1</quantity>
  <quantity>3</quantity>
  <quantity>3.4</quantity>
  <quantity>Hello</quantity>
</product>


How about this case:


<products>
  <quantity>1</quantity>
</products>
--

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo@xxxxxxxxxxxxxxx | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|           Processing XML with Java (Addison-Wesley, 2002)          |
|              http://www.cafeconleche.org/books/xmljava             |
| http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA  |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
|  Read Cafe con Leche for XML News: http://www.cafeconleche.org/    |
+----------------------------------+---------------------------------+

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Current Thread