[thelist] [XSL] testing up the hierarchy

Howard Cheng howcheng at ix.netcom.com
Wed Dec 18 15:49:01 CST 2002


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>
    <category uid="cat_b">
       <item uid="cat_b_1" />
       <item uid="cat_b_2" />
    </category>
</navigation>

What I want to do is, if I'm in any <item> test if the parent category's
selected attribute is true. In other words, I'm trying to make it so that
when I'm in any section in a certain category, all navigation items in that
category are visible.

So far I've got <xsl:if
test="ancestor::node[name()='category']/@selected='true'"></xsl:if> but
that's not doing it for me.

Any ideas? Thanks in advance.

::::::::::::::::::::::::::::::::::
Howard Cheng
http://www.howcheng.com/
howcheng at ix dot netcom dot com
AIM: bennyphoebe
ICQ: 47319315




More information about the thelist mailing list