[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] Is an XPath processor responsible for catching misspelled tag names when there is an associated Schema?
Subject: RE: [xsl] Is an XPath processor responsible for catching misspelled tag names when there is an associated Schema? From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Thu, 21 Feb 2008 14:53:45 -0000 |
You haven't shown the full context of your stylesheet/xpath expression. The processor can't assume that because an element is named Book that it will be a valid instance of the global element declaration Book in the schema. It might for example be a temporary unvalidated element, and it's perfectly legitimate to mix validated/valid trees and unvalidated/invalid trees in the same program. The XQuery/XPath formal semantics define an optional feature called "static typing" that guarantees that if the type of $b is known to be schema-element(Book), then $b/autr is a static type error. But static typing unfortunately can reject many perfectly reasonable expressions as well, so many products including Saxon choose not to implement it. Saxon will give you a compile time warning for this situation. However, if there is no static type information available, then it can't do this. To get maximum benefit from schema-aware processing, you should declare the types of your variables and function parameters (and especially, the type of the principal input). > > QUESTIONS > > 1. Is it the responsibility of a schema-aware processor to > catch misspelled tag names in XPath expressions? Yes, provided (a) the type of the context of the path is known, and (b) the processor implements static typing. > > 2. Is there a flag that I can set in SAXON to tell it to > catch such misspelling errors? You should declare the types of your variables and parameters as accurately as you can. The scope for this in freestanding XPath with Saxon is limited; if you want this it's probably best to process your XPath expressions with the XQuery processor. Michael Kay http://www.saxonica.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Is an XPath processor res, Andrew Welch | Thread | Re: [xsl] Is an XPath processor res, Andrew Welch |
Re: [xsl] Is an XPath processor res, Andrew Welch | Date | Re: [xsl] Is an XPath processor res, Florent Georges |
Month |