Re: Selecting unique value of an attribute [ restated and tested solution :)]

Subject: Re: Selecting unique value of an attribute [ restated and tested solution :)]
From: Miloslav Nic <nicmila@xxxxxxxxx>
Date: Wed, 23 Aug 2000 17:18:10 +0200
I promise I will not send example after 30 sec thinking in the future.
I would have eaten the mail if it was on a paper to punish myself
but fortunately we are in the age of e-mails and hard drives are too
hard to swallow.

I will restate the question in my terms :) :

Find all elements in the source and sort them alphabetically:

<xsl:template match="/">
  <xsl:apply-templates select="//*">
        <xsl:sort select="name()"/>
  </xsl:apply-templates>
</xsl:template>

<xsl:template match="*">
<xsl:if test="not(preceding::*[name()=name(current())])">
  <xsl:text>
  </xsl:text>
  <xsl:value-of select="name()"/>
</xsl:if>
</xsl:template>


It works. I have tested it :))))))


> 
> /-------------------------------------------------------------------\
> |  ob|do        Dipl.Inf. Oliver Becker                             |
> |  --+--        E-Mail: obecker@xxxxxxxxxxxxxxxxxxxxxxx             |
> |  op|qo        WWW:    http://www.informatik.hu-berlin.de/~obecker |
> \-------------------------------------------------------------------/
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

-- 
******************************************
<firstName> Miloslav </firstName>    
<surname>   Nic      </surname>     

<mail>    nicmila@xxxxxxxxx    </mail>   
<support> http://www.zvon.org  </support>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread