Re: [xsl] Why does this XPath expression work fine when run in Oxygen but fails when used in an XSD 1.1 assert element?

Subject: Re: [xsl] Why does this XPath expression work fine when run in Oxygen but fails when used in an XSD 1.1 assert element?
From: "Graydon graydon@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 2 Dec 2019 17:47:55 -0000
On Mon, Dec 02, 2019 at 05:26:37PM -0000, Costello, Roger L.
costello@xxxxxxxxx scripsit:
> Why does the XPath query work fine when run in Oxygen but fails when
> used in an XSD 1.1 assert element?

When you assert:

*[local-name(.) eq 'style']/following-sibling::comment()[1]/starts-with(., '[if gte mso 9]>&lt;xml>')

you're checking outside the element node.  Assertions only evaluate against the element being defined; you don't get any of the rest of the document.  XPath has the whole document.

https://www.w3.org/TR/xmlschema11-1/#Assertion_details says

To check an assertion, an instance of the XPath 2.0 data model ([XDM]) is constructed, in which the element information item being 7assessed7 is the (parentless) root node, and elements and attributes are assigned types and values according to XPath 2.0 data model construction rules, with some exceptions.


-- Graydon

Current Thread