xsl-list
[Top] [All Lists]

RE: only display if subnodes occur more than once

2005-06-23 05:27:45

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)

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>