[Home] [By Thread] [By Date] [Recent Entries]
David Carlisle wrote:
<xsl:template match="Body"> That's great (and quick)! It works like a charm. fn:starts-with() was expected in any solution because of the chosen names in my example, but I actually need a union of named nodes. Funny I never thought of using the 'except' operator though, indeed: now it is fairly simple.... For any a reason I try to avoid using for-each, but you put me in the right direction for doing the same trick with only a pull (or was it push?) model. I now use a variant of this which places the special cases to the root level, which eases maintenance, I hope: <xsl:key name="t" match="Make-Toute-Seul-1 | Make-Toute-Seul-2 | Make-Toute-Seul-3" use="''" /> <xsl:template match="/"> <xsl:apply-templates select="$copy-me/*"/> </xsl:template> <xsl:template match="Body">
<xsl:copy>
<xsl:apply-templates select="key('t', '')" />
</xsl:copy>
</xsl:template><xsl:template match="key('t', '')">
<Document>
<xsl:copy-of select="(../* except key('t', ''))|."/>
</Document>
</xsl:template><xsl:template match="* | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*" />
</xsl:copy>
</xsl:template>Thanks! Abel
|

Cart



