I want to check if there is a string which is equal to one of the attributes. For instances:
<rules>
<mother cat="pp">
<daughter cat="pr"/>
<daughter cat="np"/>
</mother>
<mother cat="wp">
<daughter cat="rp"/>
<daughter cat="vp"/>
</mother>
<mother cat="cn">
<daughter cat="jj"/>
<daughter cat="cn"/>
</mother>
<mother cat="np">
<daughter cat="jj"/>
<daughter cat="np"/>
</mother>
</rules>
I just need to test if “pp” is equal to one of the mothers’ cat attribute.
For this example yes it is. But it should be false for “pr”.
Thank You.
Use the following expression:
This expression returns the
motherelement having an attribute namedcatwhose value is equal topp.In an
xsl:iftest expression, this will returntrueif such a node exists; false, otherwise. For example:This stylesheet prints
NODE EXISTSonly when such a node is present in the source.Find this element’s position using the following expression: