[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Converting XML to CSV - how to eliminate output w

Subject: Re: Converting XML to CSV - how to eliminate output whitespace and blank lines?
From: "ohaya ohaya@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 6 Nov 2023 17:02:51 -0000
Re:  Converting XML to CSV - how to eliminate output  w
 Hi Norm,

Thanks! Your suggestion was close, but it also removed all the newlines:

customer,1234schemaName,schema_nameschemaVersion,1.0PN_ID,1111111111PN_ID,111
1111ADM_ORG_CD,urn:NORM:DEPTentUserRoles,a:b:c

But I was able to add <xsl:text> to get it to work:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="UTF-8" disable-output-escaping="YES"/>
<xsl:strip-space elements="*"/>

<xsl:template match="*[not(*)]">
 <xsl:value-of select="local-name()"/>
 <xsl:text>&#44;</xsl:text>
 <xsl:value-of select="."/>
 <xsl:text>&#10;</xsl:text>
</xsl:template>

</xsl:stylesheet>

And then, I got:

customer,1234
schemaName,schema_name
schemaVersion,1.0
PN_ID,1111111111
PN_ID,1111111
ADM_ORG_CD,urn:NORM:DEPT
entUserRoles,a:b:c

Thanks!

Jim


     On Monday, November 6, 2023 at 03:24:06 AM EST, Norm Tovey-Walsh
<ndw@xxxxxxxxxx> wrote:

 > Notice the whitespace in front of each line and also the blank lines
> between sub-nodes, e.g., so the output would be just:

Try adding <xsl:strip-space elements="*"/>. I think that will fix it,
though my XSLT 1.0 is a bit rusty these days.

B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  Be seeing you,
B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  norm

--
Norm Tovey-Walsh <ndw@xxxxxxxxxx>
https://norm.tovey-walsh.com/

> We are the universe, trying to understand itself.--Delenn

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.