xsl-list
[Top] [All Lists]

Re: getting crlf's, but putting only lf's (i think)

2003-11-02 01:57:07
Try

<xsl:strip-space elements="list-of-element-names"/>

The <xsl:strip-space> element is used to define the elements for which white
space should be removed. * will do all i think


PA Sport RnD

Andrew Curry
Software Developer

Telephone: 01430 455545
Website:        http://www.pa.press.net

PA News Limited:
Bridgegate, Howden, East Yorkshire, DN14 7AE

Registered Office:
PA News Limited, 292 Vauxhall Bridge Road, London SW1V 1AE. Registered in
England No. 3891053


----- Original Message ----- 
From: "Ray Tayek" <rtayek(_at_)comcast(_dot_)net>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Cc: "Martin Hubert" <mhubert(_at_)up-time(_dot_)net>
Sent: Monday, November 03, 2003 6:08 AM
Subject: [xsl] getting crlf's, but putting only lf's (i think)


hi, i get crlf's in my transformed output when using the following (see
below). i am trying to convert an xml file into a csv file. all is well
except that xalan-j_2_5_1 is putting crlf's into the output stream
(doesn't
matter whether it's a writer or a byte output stream). is there any way to
get rid of the carriage return?

any pointers will be appreciated.

thanks

input xml file:

<?xml version="1.0" encoding="UTF-8"?>
<outputRows>
<outputRow>
<inputRecordSequenceNumber>1</inputRecordSequenceNumber>
<copy1>copy1Value1</copy1>
<renamed1>rename1Value1</renamed1>
<new1>new1ValueFromSpecial1Name</new1>
<new2>new2ValueFromSpecial1Name</new2>
<new3>special1Value1</new3>
</outputRow>
<outputRow>
<inputRecordSequenceNumber>1</inputRecordSequenceNumber>
<copy1>copy1Value1</copy1>
<renamed1>rename1Value1</renamed1>
<new1>new1ValueFromSpecial2Name</new1>
<new2>new2ValueFromSpecial2Name</new2>
<new3>special2Value1</new3>
</outputRow>
<outputRow>
<inputRecordSequenceNumber>2</inputRecordSequenceNumber>
<copy1>copy1Value2</copy1>
<renamed1>rename1Value2</renamed1>
<new1>new1ValueFromSpecial1Name</new1>
<new2>new2ValueFromSpecial1Name</new2>
<new3>special1Value2</new3>
</outputRow>
<outputRow>
<inputRecordSequenceNumber>2</inputRecordSequenceNumber>
<copy1>copy1Value2</copy1>
<renamed1>rename1Value2</renamed1>
<new1>new1ValueFromSpecial2Name</new1>
<new2>new2ValueFromSpecial2Name</new2>
<new3>special2Value2</new3>
</outputRow>
</outputRows>

xslt file:

<?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:strip-space elements="outputRows outputRows/outputRow"/>
     <xsl:template match="outputRows">

<xsl:text>inputRecordSequenceNumber,copy1,remove1,rename1,special1,special2&
#10;</xsl:text>
         <xsl:apply-templates/>
     </xsl:template>
     <xsl:template match="outputRows/outputRow">
         <xsl:apply-templates/>
         <xsl:text>&#10;</xsl:text>
     </xsl:template>
     <xsl:template match="outputRows/outputRow/*">
         <xsl:value-of select="."/><xsl:if test="position() !=
last()">,</xsl:if>
     </xsl:template>
</xsl:stylesheet>

output file:

inputRecordSequenceNumber,copy1,remove1,rename1,special1,special2

1,copy1Value1,rename1Value1,new1ValueFromSpecial1Name,new2ValueFromSpecial1N
ame,special1Value1

1,copy1Value1,rename1Value1,new1ValueFromSpecial2Name,new2ValueFromSpecial2N
ame,special2Value1

2,copy1Value2,rename1Value2,new1ValueFromSpecial1Name,new2ValueFromSpecial1N
ame,special1Value2

2,copy1Value2,rename1Value2,new1ValueFromSpecial2Name,new2ValueFromSpecial2N
ame,special2Value2




---
ray tayek http://tayek.com/ actively seeking mentoring or telecommuting
work
vice chair orange county java users group http://www.ocjug.org/
hate spam? http://samspade.org/ssw/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list