I'm a newby and have a problem of searching for a value in a xml node tree with a key, maybe someone can help me with this:
I have a variable $myElement and the value is a nodetree something like this:
<nodetree>
<xsd:sequence>
<xsd:element ref="A">
<xsd:element ref="B">
</xsd:sequence>
</nodetree>
I have defined a key like this:
<xsl:key name="searchtree" match="xsd:sequence/xsd:element" use="string(@ref)" />
I want to check if variable $myValue is in the tree. For instance with the value "B".
I tried this but I never get any results
- <xsl:if test="$myElement/key('searchtree',$myValue)"/>
- <xsl:variable name="myTest" select="$myElement/key('searchtree',$myValue)"/>
What am i doing wrong.:(