Altova Mailing List Archives


RE: [xsl] Matching a recursive local element structure

From: "David Lee" <dlee@-------.--->
To: <xsl-list@-----.------------.--->
Date: 2/5/2011 2:59:00 PM
Thanks Michael, this gives me something to think about.
-David


----------------------------------------
David A. Lee
dlee@c...
http://www.xmlsh.org


-----Original Message-----
From: Michael Kay [mailto:mike@s...] 
Sent: Saturday, February 05, 2011 9:53 AM
To: xsl-list@l...
Subject: Re: [xsl] Matching a recursive local element structure



I think that it's reasonably easy, from a given global element 
declaration, to construct a list of possible paths to descendents of 
that element, where the paths are in the form of regular expressions, 
for example HTML/BODY/(LIST/ITEM)*. It's also not a hard problem to 
determine whether a particular element matches one of these regular 
expressions. The tough bit is translating these regular expressions into 
XSLT match patterns.

But if you allow predicates in your patterns, there would seem to be at 
least two ways of doing it. One is to use regular expressions directly:

match="*[matches(string-join(ancestor::*/local-name(),'/'), 
'HTML/BODY/(LIST/ITEM)*')]"

The other is for the predicate to include a call to a recursive function 
- I haven't worked out the details of what it might look like, but it 
seems clear enough that it's possible (it would be easier if there were 
a more straightforward way of writing a function that tests whether an 
element matches a given pattern).

Can it be done without predicates? I think almost certainly not.

Note: all of this assumes the absence of wildcards in the schema.

Michael Kay
Saxonica

--~------------------------------------------------------------------
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@l...>
--~--



--~------------------------------------------------------------------
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@l...>
--~--

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.