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

Re: disappearing line breaks within an element

Subject: Re: disappearing line breaks within an element
From: "cavecatem@xxxxxxxxxxxxx" <cavecatem@xxxxxxxxxxxxx>
Date: Tue, 27 Jan 2009 16:59:38
 Re: disappearing line breaks within an element
Hi Michael,

thanks for your suggestions.
I had to do some checking up, as I couldn't reproduce your results with my
xslt.

Today I ran some tests with a simple file and a new XSL stylesheet. And things
turn out to be even more confusing that I though:
This is my input file:
<?xml version="1.0" encoding="UTF-8"?>

<test>a&#xD;b&#xD;C&#xD;D</test>

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

    <xsl:output name="inhalt" method="xml"  omit-xml-declaration="yes" />

      <xsl:preserve-space elements="*"/>

    <xsl:template match="test">

        <xsl:copy-of select="."/>

    </xsl:template>
</xsl:stylesheet>

I get
<?xml version="1.0" encoding="UTF-8"?>
<test>a&#xD;b&#xD;C&#xD;D</test>

If the template is
<xsl:template match="test">
        <html>

        <xsl:copy-of select="."/>

        </html>
    </xsl:template>

the result is this:
<html>
   <test>abCD</test>
</html>

As I'm using Oxygen, I checked if the results were the same if I called saxxon
from the command line, and they are.

I do hope the #xd codes are not converted into line breaks when I send this
mail. So, probably to prevent problems with browsers, the line-break codes are
eliminated whenever I output to a descendent of an  html-element.

Regards
CJ

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-2007 All Rights Reserved.