Re: [xsl] select element based on value of one of the children

Subject: Re: [xsl] select element based on value of one of the children
From: Geert Josten <Geert.Josten@xxxxxxxxxxx>
Date: Tue, 11 Oct 2005 11:42:12 +0200
Either you can select the nodeset like:
<xsl:apply-templates select="a[b='7']"/>

<xsl:template match="a">
..
</template>

This is more like a pull method: picking only the interesting part from the source tree.


<xsl:apply-templates select="a"/>

<xsl:template match="a[b='7']">
  <!-- This template will overrule the more general one, provided that
the predicate is true (that the child element b has a string value of
'7') -->
..
</xsl:template>

While this is more of a push method: just start template matching all and figure out later what to ignore or not..


(loosly translated, I bet there are lots of articles on this..)

Cheers,
Geert

Current Thread