RE: [xsl] Xpath problem

Subject: RE: [xsl] Xpath problem
From: Jeff Beadle <Jbeadle@xxxxxxxx>
Date: Mon, 4 Mar 2002 16:17:56 -0500
Hello Kan,

from a ancestor of the desired "value" attribute whose content is '2111':

   //*[@value='2111']


or from anywhere:

   /*//*[@value='2111']


But, be advised that these will bring back all elements (any element) that 
has an attribute named "value" and whose value is '2111'.

If you expected the possiblity of many elements returned, but only care
about the first then you append another predicate to the end of the first 
one to return the first node:

   //*[@value='2111'][1]


or from anywhere:

   /*//*[@value='2111'][1]
  

But since you are using "selectSingleNode" you wouldn't have to worry about
this, it'll always just return the first node from the list of elements 
found.

You may want to look up some information on XPath "Predicates" and how they
work.


-Jeff


-----Original Message-----
From: Kanthi Damodaran [mailto:kdsm17@xxxxxxxxxxx]
Sent: Monday, March 04, 2002 3:30 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Xpath problem


Hi -

This might seems like a really silly question, dur to my unfamiliarity with 
XPath syntax and functions.  Here is the problem.

I want to specify a path to a specific value in my XML Dom ie Path = 
"//value='2111' and I did this by using the selectSingleNode method of the 
DOM.  But the problem is that it also picks up following values '21112', 
21113' etc.  How do I specify that I want the node ONLY if it is '2111'?

Thanks in advance for the help.
Kan


_________________________________________________________________
Join the world's largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


 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