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 = "root/user" ><xsl:sort select="firstName"/>
<xsl:variable name="currentLetter" select = "substring(firstName,1,1)"/>
<xsl:value-of select="$currentLetter"/>
<!--
<xsl:if test ="$currentLetter!=$lastLetter">
<xsl:variable name="lastLetter" select = "substring(LName,1,1)"/>
<xsl:value-of select="$lastLetter"/>
</xsl:if>
-->
</xsl:for-each>
but you can't replace variable values in XSL ?
How would you guys approach this problem ? ?
Thanks
STev
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 = "root/user" ><xsl:sort select="firstName"/>
<xsl:variable name="currentLetter" select = "substring(firstName,1,1)"/>
<xsl:value-of select="$currentLetter"/>
<!--
<xsl:if test ="$currentLetter!=$lastLetter">
<xsl:variable name="lastLetter" select = "substring(LName,1,1)"/>
<xsl:value-of select="$lastLetter"/>
</xsl:if>
-->
</xsl:for-each>
but you can't replace variable values in XSL ?
How would you guys approach this problem ? ?
Thanks
STev