This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Clean data using XSLT




Hi,
I have some data in the following format:
<RootNode>
     <Property Id="103">
     2109 B'way
     </Property>
     <Property Id="103">
     2109 Bdwy
     </Property>
     <Property Id="103">
     2109 Broadway
     </Property>
     <Property Id="104">
     5 Bleecker Street
     </Property>
     <Property Id="104">
     5 Bleeker Street
     </Property>
     <Property Id="104">
     5 Bleecker Street
     </Property>
     <Property Id="103">
     2109 Broadway
     </Property>
</RootNode>

I use this XSLT on it:
<xsl:for-each select='//Property[not(.=preceding::Property)]'>
     <xsl:sort select="@Id" />

     <xsl:variable name="PropertyAddress" select="text()" />

     <BR />
     <xsl:value-of select="@Id" />) <xsl:value-of select="." />
     (appears <xsl:value-of select="count(//Property[.=$PropertyAddress])" />
times)

</xsl:for-each>

This gives me the following input:
103) 2109 B'way (appears 1 times)
103) 2109 Bdwy (appears 1 times)
103) 2109 Broadway (appears 2 times)
104) 5 Bleecker Street (appears 2 times)
104) 5 Bleeker Street (appears 1 times)

I would like to have the data also sorted by the number of times this version of
 the address appears in the data, so my output would be:
103) 2109 Broadway (appears 2 times)
103) 2109 B'way (appears 1 times)
103) 2109 Bdwy (appears 1 times)
104) 5 Bleecker Street (appears 2 times)
104) 5 Bleeker Street (appears 1 times)

Can someone tell me how to do this?
I am using the July version of the MSXML parser.

Thanks for your help,
Michal




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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]