I have XML like:
<outer>
.....
<a>someArbitaryText</a>
.....
<b>alsoSomeArbitaryText</b>
.....
<c>likewise</c>
......
<d>likewise</d>
</outer>
I'm looking for a single Xpath ___expression which
evaulates to the text at <c> if the text at <a>
matches the text at <b>, otherwise to the text at <d>.
I'm using Xalan. And yes, I know I could do it in
stages in XSLT but I need a SINGLE XPath
___expression. (Why?: because my transform is driven
by an XML configuration file defining the XPaths of
the items of interest in the source document. My XSLT
reads the XPath __expression from the configuration
file, and evaluates it as an XPath using
xalan:evaluate(). In this particular case the location
of the item to be used depends on whether 2 other
elements have the same text values.)
I can do it this way:
//c|//d[position()=2-number(//a=//b)]
but this, I believe (correct me if I'm wrong) assumes
c & d appear in this order. Is there a way which is
independent of the order of c and d in the source
document (whilst being a single Xpath _expression)?
Suggestions greatly appreciated.
Pete
________________________________________________________________________
BT Yahoo! Broadband - Save £80 when you order online today. Hurry! Offer ends
21st December 2003. The way the internet was meant to be.
http://uk.rd.yahoo.com/evt=21064/*http://btyahoo.yahoo.co.uk
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list