[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: This could be simple, but not for me!

Subject: RE: This could be simple, but not for me!
From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx>
Date: Tue, 25 May 2004 14:46:20 +0100
RE:  This could be simple
> Thanks, Andrew
> 
> This is very very close to what I need. But the city name has 
> to be there only once for all names like:
> 
> 
> 100, Red
>     City1
>         Name1
>         Name10
>         Name100
>         ...etc
> 
>     City2
>         Name4
>         Name40
>         ...
> 
> 200, Blue
>     City1
>         Name2
>         Name20
>         ...
> 
>     City2
>         Name5
>         ...
> 
> 300, Green
>     City1
>         Name3
>         Name30
>         Name300
>         Name3000
>         ...
> 
> 400, Yellow
>     City2
>         Name6
>         ...
> 
> Is that possible as well?


Sure, just add an extra key and an if test around the value-of to check
if it's the first occurance of that value:

<xsl:key name="cities" match="City" use="."/>

and the if test:

<xsl:if test="generate-id(ancestor::Community/City) =
generate-id(key('cities',ancestor::Community/City)[1])">
  <span><xsl:value-of select="ancestor::Community/City"/></span>
</xsl:if>

Now, this might fail at the moment because I'm guessing at the structure
of your xml, if its anything other that one <City> per <Community> then
you will need to adjust it.

cheers
andrew

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.