|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Matching braches without a certain node
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








