Suppose we have this XML:
<top>
<middle id="1">
<data>value</data>
<foo>bar</foo>
</middle>
<middle id="2">
<data>value</data>
</middle>
<middle id="3">
<data>value</data>
<foo>bar</foo>
</middle>
</top>
I want to match the 'middle' nodes that _don't_ have the 'foo' node (id==2).
This seems to work:
<xsl:template match="/">
[stuff before]
<xsl:for-each select="//middle">
<xsl:if test="not (foo[node()]">
[Whatever I want to do]
</xsl:if>
</xsl:for-each>
</xsl:template>
(You get the general idea.) Isn't there any simpler way to do this?? I'd
rather do something where, in one line, I match the 'middle' nodes without
the 'foo' tag, and then do an unconditional loop over these nodes.
Thanks!
-Ted
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|