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

Xpath expression with condition sought...

Subject: Xpath expression with condition sought...
From: Peter Mabley <p7777m@xxxxxxxxxxx>
Date: Tue, 9 Dec 2003 21:07:20 +0000 (GMT)
xpath condition
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


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.