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

RE: Matching a recursive local element structure

Subject: RE: Matching a recursive local element structure
From: "David Lee" <dlee@xxxxxxxxxxx>
Date: Sat, 5 Feb 2011 09:59:00 -0500
RE:  Matching a recursive local element structure
Thanks Michael, this gives me something to think about.
-David


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


-----Original Message-----
From: Michael Kay [mailto:mike@xxxxxxxxxxxx] 
Sent: Saturday, February 05, 2011 9:53 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  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

Current Thread

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