[thelist] [XSL] testing up the hierarchy

Jason Bauer jbauer_23 at yahoo.com
Thu Dec 19 16:05:01 CST 2002


--- Howard Cheng <howcheng at ix.netcom.com> wrote:
> I'm making site navigation from an XML document,
> which looks something like:
>
> <navigation>
>     <category uid="cat_a" selected="true">
>        <item uid="a" selected="true">
>           <item uid="a_1" selected="true">
>              <item uid="a_1_1" selected="true" />
>              <item uid="a_1_2" />
>              <item uid="a_1_3" />
>           </item>
>           <item uid="a_2" />
>           <item uid="a_3" />
>        </item>
>     </category>
>
> What I want to do is, if I'm in any <item> test if
> the parent category's
> selected attribute is true.

Check out this website, it is a great reference for
stuff like this.

http://www.topxml.com/xsl/XPathRef.asp

I think this is what you need:

<xsl:if
test="ancestor::category/@selected='true'"></xsl:if>

I got this from the examples near the bottom of the page...

=====
---
Jason Bauer
jbauer_23 at yahoo.com

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



More information about the thelist mailing list