|
Subject: Matching braches without a certain node From: Theodore Weatherly <tweather@xxxxxxxxxxxxxxxxxxxx> Date: Tue, 28 Nov 2000 12:30:17 -0800 |
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
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: Nested Grouping problem [with l, Steve Muench | Thread | Re: Matching braches without a cert, David Carlisle |
| [no subject], Monica Gupta | Date | One XML styled with several XSL(T), Raj Muchhala |
| Month |