[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Question about which XPaths can be evaluated on a DOM as it is beingbuil

  • From: Rick Jelliffe <rjelliffe@allette.com.au>
  • To: xml-dev <xml-dev@lists.xml.org>
  • Date: Thu, 19 Aug 2021 15:01:32 +1000

Question about which XPaths can be evaluated on a DOM as it is beingbuil
A question.

My scenario is I have a SAX stream, which comes in and builds a DOM.  I want to get Schematron validation results ASAP but chunked to the element not the start-tag: for this, just running as many assertions for an element as soon as its end-tag arrives is good enough.  I.e. progressive bottom-up validation.

(Yes, I am aware that there are other categories possible, such as what can be known at start-tag.  I guess I should re-read XPath3/XSLT3 to see if they have defined anything here for their streaming.)

So I want to categorize the assertions and rules into two buckets: those that can always be assessed right away at the end-tag, and those that may not.  And hopefully without having to fully parse the XPath, or to minimally parse them.

For minimal Schematron, this would be rule/@context,  assert/@test, let/@value. (Lets leave keys, value-of, etc. off.)  For XSLT, this would be the equivalent of the xsl:template/@match and xsl:template//*/@test and xsl:variable/@select.

So to get those that can be reliably assessed, is this enough:
  •    The XPath does not contain
    • "following" or
    • "position("  or
    • have a upward axis followed by a downward axis  or
    • a predicate with a positional indicator  AND
  •    It does not contain a reference to any variable (or function, or named xsl:template) which does, at any depth
The first three of the tests are trivial string matching, but the last one is more difficult: it looks like it requires a parse with awareness of resulting type. 

So my questions are: is there some missing case, and is there some cheapo way to determine if a numeric positional predicate is being used?

Cheers
Rick


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.