RE: [xsl] Xpath expression with condition sought...

Subject: RE: [xsl] Xpath expression with condition sought...
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 9 Dec 2003 23:20:23 -0000
/xxxxx[a=b]/c | /xxxxx[a!=b]/d

Here /xxxxx represents a path to the parent of a,b,c,d, which you
haven't shown us.

Michael Kay


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Peter Mabley
> Sent: 09 December 2003 21:07
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Xpath expression with condition sought...
> 
> 
> 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
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread