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 A. Lee

-----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:


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

XSL-List info and archive:
To unsubscribe, go to:
or e-mail: <mailto:xsl-list-unsubscribe@l...>

XSL-List info and archive:
To unsubscribe, go to:
or e-mail: <mailto:xsl-list-unsubscribe@l...>


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 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.