Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Very Hard XSLT Transformation

Status
Not open for further replies.

sssssss

Programmer
Feb 21, 2002
1
US
Hi XML Experts;

This is the Hardest Transformation I have ever had to do. Could someone help ??

I have an xml tree consisting of users
<root>
<user>
<firstName/>
<middleName/>
<lastName/>
</user>
<user>
<firstName/>
<middleName/>
<lastName/>
</user>
</root>

In my Transformation, I'm looping through user and sorting on lastName

But at the bottom of the resulting list I need to output the first unique letter of each last name ?

Example, If we have last names

Abe, Jimmy
Adams, Harry
Baldwin, Bob
Clinton, George
Fiona, Carly
Gates, Bill
Guntars, Jay
Williams, Wolly
Wilimina, Winston

Then I need to produce the following links below
A B C F G W
not
AABCFGGWW

<xsl:for-each select = &quot;root/user&quot; ><xsl:sort select=&quot;firstName&quot;/>
<xsl:variable name=&quot;currentLetter&quot; select = &quot;substring(firstName,1,1)&quot;/>
<xsl:value-of select=&quot;$currentLetter&quot;/>
<!--
<xsl:if test =&quot;$currentLetter!=$lastLetter&quot;>

<xsl:variable name=&quot;lastLetter&quot; select = &quot;substring(LName,1,1)&quot;/>
<xsl:value-of select=&quot;$lastLetter&quot;/>

</xsl:if>
-->
</xsl:for-each>

but you can't replace variable values in XSL ?
How would you guys approach this problem ? ?

Thanks
STev


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top