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

parsing a token list and finding a common ancestor in

Subject: parsing a token list and finding a common ancestor in a tree
From: David J Birnbaum <djbpitt+xml@xxxxxxxx>
Date: Thu, 19 Jul 2007 14:56:15 -0400
 parsing a token list and finding a common ancestor in
Dear XSLT List,

I have a set of <node> elements with @n identifier attributes, which are unique in the document. The <node> elements nest within one another to describe a tree. Given a list of some of those @n identifiers (in the token list attribute value of another element elsewhere in the document), which point to a set of <node> elements, I need to find the common ancestors of all <node> elements referenced in that list.

Assuming the list of identifiers is in the @wit attribute of some <app> element, I think I can state my problem as: Find all <node> elements that are the shared ancestors of all <node> elements whose @n attribute value is one of the values in the @wit token list. I tried, without success, several variants of:

<xsl:foreach select="//app">
 <xsl:value-of select="//node[@n=tokenize(@wit, ' ')]/ancestor::node"/>
</xsl:foreach

This doesn't work, apparently because it looks for <node> elements whose @n value is the entire tokenized list, instead of any member of the list. That is, it seems to work when @wit is a one-item list, but it returns empty if there is more than one item specified in @wit. Furthermore, even if it did work, I fear that it might get the union of ancestors of *any* of the nodes in question, while I need the much more restricted intersection of common ancestors shared by *all* the nodes.

Have I conceptualized the problem incorrectly? Is there an obvious XPath function that would help me out that I'm overlooking? I'm using XSLT 2.0 and XPath 2.0.

Thanks,

David
djbpitt@xxxxxxxx

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.