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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--