tricky transformation

Here should go questions about transforming XML with XSLT and FOP.
Posts: 3

tricky transformation

Tue Mar 15, 2005 11:37 am


I need an idea how to write a transformation for the following xml Dokument


so that, when I use fop, the following line is created.

Jeffrey, George, Mike.

My problem is, that behind every name a comma is set, but behind the last one a dot.

I tried to do it like this:

<xsl:template match="names">

<xsl:template match="name">
<xsl:value-of select="."/>,

but as you can see, this version sets a comma after every name, even after the last one.

Thanks a lot for any ideas, how to solve this problem.
Site Admin
Posts: 2100

Tue Mar 15, 2005 1:15 pm


You can check if there is a following sibling name element and in that case output comma, otherwise output the dot.
Something like:

Code: Select all

<xsl:template match="name">
    <xsl:value-of select="."/>
        <xsl:when test="following-sibling::name">

Best Regards,

Return to “XSLT and FOP”

Who is online

Users browsing this forum: No registered users and 0 guests