Avatar of Larry Brister
Larry Brister
Flag for United States of America asked on

xsl for each statement and repeat direction

I'm trying to make my for-each repeat horizontally.

However...the following simply grabs value of the last state in the child nodes "AZ"
My desired output is AL,AK,AZ


<tr>
    <td style="width:150px;">
        <xsl:value-of select="Specialty"/>
    </td>
    <td colspan="2">
        <xsl:for-each select="StatesLicensed">
            <xsl:value-of select="State"/>,&#160;
        </xsl:for-each>
    </td>
</tr>
XML.NET ProgrammingMicrosoft Development

Avatar of undefined
Last Comment
Gertone (Geert Bormans)

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Gertone (Geert Bormans)

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Larry Brister

ASKER
Perfect.
Watch for follow-up question
This was my final code...
Haven't done much xslt...thanks.

<tr>
    <td style="width:150px;">
        <xsl:value-of select="Specialty"/>
    </td>
    <td colspan="2">
       <xsl:for-each select="StatesLicensed/State"> <xsl:value-of select="."/>,&#160;
   </xsl:for-each>
    </td>
</tr>
Gertone (Geert Bormans)

Welcome

If you added a test, you would not see the ',' at the end

     <xsl:for-each select="StatesLicensed/State">
<xsl:if test="not(position() = 1)"><xsl:text>,&#160;</xsl:text></xsl:if>
<xsl:value-of select="."/>
   </xsl:for-each>

Please give us some source XML in your next question
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck