Re: [xsl] XSLT program outputs a series of items, how toinsertnewlines between each item?

Subject: Re: [xsl] XSLT program outputs a series of items, how toinsertnewlines between each item?
From: "Roger L Costello costello@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 25 Jun 2020 13:37:44 -0000
> My suggestion is to replace the whole
> for-each with the single value-of

Oh my!

That is wicked cool!

Thanks Martin!

/Roger

-----Original Message-----
From: Martin Honnen martin.honnen@xxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, June 25, 2020 9:27 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [EXT] Re: [xsl] XSLT program outputs a series of items, how
toinsertnewlines between each item?


On 25.06.2020 15:25, Roger L Costello costello@xxxxxxxxx wrote:
> Hi Martin,
>
>
>
> I gave your suggestion a try (although, since I am running a Windows
machine, I used CRLF as the separator):
>
>
>
> <xsl:value-of select="concat(@value, ' (', xs:annotation/xs:documentation,
')')" separator="&#xD;&#xA;"/>
>
>
>
> Unfortunately, in the output the items are not separated by newlines. Any
thoughts on why that is?
>

My suggestion is to replace the whole for-each with the single value-of
I posted.


>
>
>
> -----Original Message-----
>
> From: Martin Honnen martin.honnen@xxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
>
> Sent: Thursday, June 25, 2020 9:17 AM
>
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>
> Subject: [EXT] Re: [xsl] XSLT program outputs a series of items, how to
insertnewlines between each item?
>
>
>
>
>
> On 25.06.2020 15:11, Roger L Costello costello@xxxxxxxxx wrote:
>
>> Hi Folks,
>> My XSLT program has a loop. Each iteration outputs an item. I want each
item on a new line. The following works. Is there a better way to insert
newlines than by using xsl:text with the end tag on the next line?  /Roger
>> <xsl:output method="text" />
>> <xsl:template match="/">
>>       <xsl:for-each select="//xs:simpleType[@name eq
'DatumCode']//xs:enumeration">
>>           <xsl:value-of select="concat(@value, ' (',
xs:annotation/xs:documentation, ')')/>
>> <xsl:text>
>> </xsl:text>
>>       </xsl:for-each>
>> </xsl:template>
>
>
>
>
> I would use xsl:value-of separator
>
>
>
>
>
> <xsl:value-of select="//xs:simpleType[@name eq
>
> 'DatumCode']//xs:enumeration/concat(@value, ' (',
>
> xs:annotation/xs:documentation, ')')" separator="&#10;"/>

Current Thread