[xsl] Finding immediately preceding node.

Subject: [xsl] Finding immediately preceding node.
From: Betty Harvey <betty@xxxxxxxxxx>
Date: Mon, 2 Jun 2003 09:56:15 -0400 (EDT)
I have been struggling with this problem and I can't seem to
get the XPath to work.  I have looked through the archive and
can't seem to find the answer.

I want to get the a true when I am inside <b name="cde"> and
the preceding <b> contains the attribute 'name="abc"'.  

<?xml version="1.0"?>
<a>
  <b name="abc"/>
     <c/>
  <b>
     <c/>
  </b>
  <b name="abc">
     <c/>
  </b>
  <b name="cde">
    <c/>
  </b>
  <b>
     <c/>
  </b>
  <b>
     <c/>
  </b>
  <b name="abc">
     <c/>
  </b>
</a>

The following XPath gives a value of true in 'XPathTester':

//c/../b[@name='cde']/preceding-sibling::b[1]/@name='abc'

I have the following in my xslt but never get a 'true':

<xsl:if test="../b[@name='cde']/preceding-sibling::b[1]/@name='abc'">

Thanks!

Betty

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Betty Harvey                         | Phone: 410-787-9200 FAX: 9830 
Electronic Commerce Connection, Inc. |        
harvey@xxxxxxxxxx                    | Washington,DC XML Users Grp
URL:  http://www.eccnet.com          | http://www.eccnet.com/xmlug
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\/\/  


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


Current Thread