W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2002

Re: Need help with an XPath expression in XSLT

From: Jeni Tennison <jeni@jenitennison.com>
Date: Wed, 10 Apr 2002 18:02:13 +0100
Message-ID: <127725318242.20020410180213@jenitennison.com>
To: Brenda Bell <bbell@juicesoftware.com>
CC: xmlschema-dev@w3.org
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:30 GMT