Re: [xsl] xml to csv

Subject: Re: [xsl] xml to csv
From: Geert Josten <Geert.Josten@xxxxxxxxxxx>
Date: Wed, 23 Nov 2005 11:07:17 +0100
FOP uses Xalan internally, but it may depend on your Java and FOP version which version of Xalan is actually being used.

It works okay with Xalan 2.6. Try replace the Xalan jar in your FOP distribution with a more recent one.

Regards,
Geert

Serena Phan wrote:

Thanks David. However, the processor that I`m using is Apache FOP 0.20.5 and it doesn`t seem to produce the same results as saxon.

Here`s the results I got from FOP:

a, dd1
a, dd2

Do you know how to fix that so that it works for FOP

Thanks a bunch.


Date: Mon, 21 Nov 2005 10:34:43 GMT
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
From: David Carlisle <davidc@xxxxxxxxx>
Subject: Re: [xsl] xml to csv
Message-Id: <200511211034.KAA15109@xxxxxxxxxxxxxxxxx>

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:output method="text"/>

<xsl:template match="root">
<xsl:apply-templates select="*[last()]"/>
</xsl:template>

<xsl:template match="root/*">
<xsl:param name="l"/>
<xsl:variable name="here" select="."/>
<xsl:variable name="sep">
<xsl:if test="following-sibling::*">, </xsl:if>
</xsl:variable>
<xsl:for-each select="descendant-or-self::*[not(*)]">
<xsl:choose>
<xsl:when test="$here/preceding-sibling::*">
<xsl:apply-templates select="$here/preceding-sibling::*[1]">
  <xsl:with-param name="l" select="concat(.,$sep,$l)"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
  <xsl:value-of select="concat(.,$sep,$l,'

')"/>


</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>

$ saxon bb.xml bb.xsl
a, bb1, ccc1, dd1
a, bb2, ccc1, dd1
a, bb3, ccc1, dd1
a, bb4, ccc1, dd1
a, bb1, ccc2, dd1
a, bb2, ccc2, dd1
a, bb3, ccc2, dd1
a, bb4, ccc2, dd1
a, bb1, ccc1, dd2
a, bb2, ccc1, dd2
a, bb3, ccc1, dd2
a, bb4, ccc1, dd2
a, bb1, ccc2, dd2
a, bb2, ccc2, dd2
a, bb3, ccc2, dd2
a, bb4, ccc2, dd2

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/




-- Drs. G.P.H. Josten Consultant



Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665  JZ  Bleiswijk
Tel: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl


De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend.


Current Thread