[xsl] RE : Still Testing!

Subject: [xsl] RE : Still Testing!
From: "Adam J Knight" <adam@xxxxxxxxxxxxxxxxx>
Date: Sun, 13 Feb 2005 21:04:02 +1000
If the current node id 8 and c_node is 7 then that test will be true.
As you don't say what you did or in what way you think it didn't work,
hard to give any advice.  David

Reply:

This is my xsl:template I am using.
It doesn't appear to work, in that the second condition doesn't cause the
display of the appropriate value.

<xsl:template match="tree_node">

	<xsl:if test="parent::tree or parent::tree_node[@id=$c_node]">
          <xsl:value-of select="@value"/>
      </xsl:if>

  </xsl:template>


<?xml version="1.0"?>
<tree>
  <tree_node id="7" value="Test">
    <tree_node id="8" value="Test Sub"/>
      <tree_node id="9" value="Test Sub One">
      <tree_node id="10" value="Test Sub Two">
        <tree_node id= 11  value= Test Sub Three />
      </tree_node>
    </tree_node>
  </tree_node>
</tree>

My understanding of the above template is that is will match all tree_node
elements, regardless of node depth. However, when the context node is
tree_node with id 8, the node that meets the second condition ($c_node=7)
the appropriate value is not outputted.

What am I missing??

Cheers,
Adam
 
NB: "Pray as if everything depended upon God and work as if everything
depended upon man."

Current Thread