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

RE: Identity Transform losing original line feed

Subject: RE: Identity Transform losing original line feed
From: Geert Josten <Geert.Josten@xxxxxxxxxxx>
Date: Sat, 19 Jul 2008 15:05:18 +0200
RE:  Identity Transform losing original line feed
Ken,

Yes, XML readers normalize CR and LF. But I thought, writers would write CR
and LF based on OS again. At least, on my windows machine I see that most
processors are writing CR/LF..

Karl,

Tried using <xsl:output indent="no" /> together with <xsl:preserve-space
elements="*" />? As Jesper points out, it doesn't preserve *all* ignorable
white-space, but at least those between tags.

Kind regards,
Geert

>


Drs. G.P.H. Josten
Consultant


http://www.daidalos.nl/
Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665 JZ Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
http://www.daidalos.nl/
KvK 27164984
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.


> From: G. Ken Holman [mailto:gkholman@xxxxxxxxxxxxxxxxxxxx]
> Sent: zaterdag 19 juli 2008 4:07
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  Identity Transform losing original line feed
>
> At 2008-07-18 16:29 -0700, Karl Stubsjoen wrote:
> >I have a number of xsl templates which I am running an
> identity transform on:
> >
> ><xsl:template match="node() | @*">
> >     <xsl:copy>
> >         <xsl:apply-templates select="@* | node()" />
> >     </xsl:copy>
> ></xsl:template>
> >
> >
> >     <xsl:template match="xsl:import/@href | xsl:include/@href">
> >         <xsl:attribute name="href">
> >             <xsl:value-of select="concat('get?include=', .)"/>
> >         </xsl:attribute>
> >     </xsl:template>
> >
> >
> >The basic principle here, is preserve the original templates
> exactly,
> >but update the import and include href tag as specified.
> >So the transform works fine except that the line feed character is
> >changed after the transform.
>
> An XML processor is obliged to transform all end-of-line
> sequences into a line-feed character.
>
> >My proof of this is a simple, open in
> >notepad, where before the transform I have line spaces, and
> after the
> >transform I do not.
> >
> >So what gives?  What is happening to those line feeds?  Here
> is my output tag:
> >
> ><xsl:output method="xml" version="1.0" encoding="UTF-8"
> indent="yes"/>
>
> I *never* use indent="yes" with the identity transform
> because I'm not convinced all processors treat the
> white-space-only text nodes the same (or close to the same)
> when indented.
>
> When I use the identity transform I leave indent="no" in
> order to preserve the original input file indentation ... you
> said you wanted to preserve the original templates exactly,
> so don't ask the processor to do arbitrary indentation.
>
> But as for the line feed character, if you use CR-LF or CR
> you will end up with just LF in the output because of XML
> rules, not because of XSLT rules.
>
> If you are using XSLT 2 and you want to force your output to
> be CR-LF then use the output character-map facility to get this.
>
> I hope this helps.
>
> . . . . . . . . . . . Ken
>
>
> --
> Upcoming XSLT/XSL-FO hands-on courses:      Wellington, NZ 2009-01
> World-wide corporate, govt. & user group XML, XSL and UBL training
> RSS feeds:     publicly-available developer resources and training
> G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
> Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
> Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
> Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
> Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

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.