xsl-list
[Top] [All Lists]

[xsl] Re:[xsl] disappearing line breaks within an element

2009-01-27 11:00:12
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



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>
  • [xsl] Re:[xsl] disappearing line breaks within an element, cavecatem(_at_)directbox(_dot_)com <=