Subject: Re: [xsl] 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 |
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>,</xsl:text> <xsl:value-of select="."/> <xsl:text> </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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Converting XML to CSV - h, Norm Tovey-Walsh ndw | Thread | [xsl] Job Opening: Editorial and Te, Sewell, David R (drs |
Re: [xsl] Converting XML to CSV - h, Piez, Wendell A. (Fe | Date | [xsl] Job Opening: Editorial and Te, Sewell, David R (drs |
Month |