Subject: RE: only display if subnodes occur more than once
From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx>
Date: Thu, 23 Jun 2005 13:27:45 +0100
|
I wrote:
> <xsl:template match="sub_a|sub_b|sub_c">
> <xsl:variable name="copy"
> select="boolean(*/following-sibling::*[local-name() =
> preceding-sibling::*/local-name()])"/>
>
> <xsl:if test="$copy">
> <xsl:copy-of select="."/>
> </xsl:if>
> </xsl:template>
...which relies on the slash operator in 2.0.
A 1.0 solution that I've cobbled together quickly is:
<xsl:template match="sub_a|sub_b|sub_c">
<xsl:variable name="copy">
<xsl:for-each select="*">
<xsl:if test="following-sibling::*[local-name()
= local-name(current())]">true</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:if test="contains($copy, 'true')">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:template>
(Not very good)
|