Re: Need help with an XPath expression in XSLT

Hi Brenda,

XSLT questions should be directed at XSL-List
(http://www.mulberrytech.com/xsl/xsl-list). This list is for XML
Schema questions.

> I have an XSLT transformation where I need to add an attribute to
> any given element <D> if the value of <B> is 1 where <D> and <B>
> have the same ancestor <A>.
>
> I'm having trouble getting the right expression on my <xsl:if> element to
> test the value of the right <B> element given a context node of <D>.

From the D element, you need to go up to the ancestor A element:

  ancestor::A

then down to its child B element:

  ancestor::A/B

and then test if that is 1:

  ancestor::A/B = 1

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Wednesday, 10 April 2002 13:02:15 UTC