xsl-list
[Top] [All Lists]

Re: [xsl] XPath 2.0 Best Practice: wrap the first node of every path expression within schema-element?

2008-03-21 09:35:48
Costello, Roger L. wrote:

Here I wrap the first node in the path expression within
schema-element:

    /schema-element(Book)/Author/LastName

The benefits of doing this are:

1. At compile-time the processor will validate the Book input element.

2. At compile-time the processor will detect errors in the path
expression:

   2.1 Misspelling errors: these spelling errors are caught:

       /schema-element(Book)/Authr/LastName  (Author is misspelled)
/schema-element(Book)/Author/LastNam (LastName is misspelled)

   2.2 Structural errors: suppose the in-scope schema indicates that
the only children of Author are FirstName and LastName; this error will be caught:

       /schema-element(Book)/Author/Foo  (Foo is not a valid child of
Author)

Is that something that the XSLT/XPath specification requires that these problems are reported as errors? I don't think AltovaXML does report such problems although it is a schema aware XSLT 2.0 processor.

--

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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--