|
Subject: RE: Construct a list without duplicate element From: "Harbarth, Juliane" <jhb@xxxxxxxxxxxxxx> Date: Wed, 30 Jun 1999 15:45:10 +0200 |
something like :
<xsl:template match="plants">
<xsl:for-each select="plant" order-by="plant[@color]">
<xsl:variable name="currentColor"><xsl:value-of
select="@color"/></xsl:variable>
<xsl:if
test="count(from-preceding-siblings(plant[@color=$currentColor]))=0">
<plant>
<xsl:attribute name ="color">
<xsl:value-of select="@color"/>
</xsl:attribute>
<xsl:value-of select="."/>
</plant>
</xsl:if>
</xsl:for-each>
</xsl:template>
is supposed to read in something that looks like :
<plants>
<plant color="red">Rose1</plant>
<plant color="blue">Rose2</plant>
<plant color="red">Rose3</plant>
<plant color="green">Rose4</plant>
...
and output a list of plants omitting the ones of which the
color occurred before.
Juliane Harbarth
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Construct a list without duplicate , Éric Riblair | Thread | Re: Construct a list without duplic, Éric Riblair |
| Who uses XSLT?, Paul Prescod | Date | Advice on a web site using XML and , Steven Livingstone, |
| Month |