Note that there are some explanatory texts on larger screens.

plurals
  1. POXSLT text output processor differences
    primarykey
    data
    text
    <p>I encountered some peculiar difference in behavior of XSLT processors. I wonder what is the reason behind this and whether there is a full overview available somewhere of processor differences.<br> I tested the following simple transformation (with a dummy input):</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"&gt; &lt;xsl:output method="text"/&gt; &lt;xsl:template match="/"&gt; &lt;xsl:text&gt;1=&amp;#xA;2=&amp;#xD;3=&amp;#xD;&amp;#xA;4=&amp;#xA;&amp;#xD;end&lt;/xsl:text&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>Run in XML Spy (v 2011 sp1 x64), the output is: </p> <pre><code>1= 2= 3= 4= end </code></pre> <p>In all cases, in hex after the <code>=</code>, and on the line after <code>4=</code>, two characters have been added, <code>0D</code> and <code>0A</code>. Apparently, XML Spy replaces each request for <code>&amp;xA;</code> or <code>&amp;xD;</code> by a full CR+LF occurrence, except when CR and LF are requested in that order, right after each other (see the 3= part).</p> <p>But when run in saxon9he, I get a warning that I am running a v1.0 stylesheet with a v2.0 processor, and the output is </p> <pre><code>1= 2=3= 4= end </code></pre> <p>In this case, all requests for <code>&amp;xA;</code> are replaced by <code>0D 0A</code> (so a CR is added in front of the LF), but a request for <code>&amp;xD;</code> outputs the requested CR, not an additional LF.</p> <p>Rerunning in XML Spy setting XSLT version to 2.0 gives the same result as for 1.0, so I guess it's not a different convention in the two XSLT versions that is causing this.<br> Most probably, this is just a diff between tools we have to know about, but I wonder whether there is more to say on the subject.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload