Nested Loop (XSL) only indent top iterations

I am trying to format XML to text like this

ab
ab

This is
This is the XML

<Doc>
<line>
    <letter>
        <value>a</value>
    </letter>
    <letter>
        <value>b</value>
    </letter>
</line>
<line>
    <letter>
        <value>a</value>
    </letter>
    <letter>
        <value>b</value>
    </letter>
</line>
</Doc>

This is the XSL:

<xsl:output method="text" indent="no" omit-xml-declaration="yes" />
<xsl:template match="/">
<xsl:for-each select="Doc/line">
    <xsl:for-each select="letter">
        <xsl:value-of select="value"/>
        <xsl:text> </xsl:text>
    </xsl:for-each>
</xsl:for-each>
</xsl:template>

Should I add in a line break manually

<xsl:text>
</xsl:text>

or is there a way to use the xsl:output to do this?

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s