Project

Profile

Help

Does saxon:newline work?

Added by Martin Honnen over 2 years ago

I am struggling to get the serialization parameter saxon:newline to work, sample XSLT is

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:saxon="http://saxon.sf.net/"
    exclude-result-prefixes="#all"
    version="3.0">
    
    <xsl:output method="xml" indent="yes" saxon:newline="&#13;&#10;"/>
    
    <xsl:template match="/" name="xsl:initial-template">
        <text>
            <xsl:iterate select="1 to 5">
                <para>
                    <xsl:value-of select="string-join((1 to 5)!('Line ' || .), codepoints-to-string(10))"/>                    
                </para>
            </xsl:iterate>
        </text>
    </xsl:template>
    
</xsl:stylesheet>

and run it with e.g. java -jar 'C:\Program Files\Saxonica\SaxonEE10-6J\saxon-ee-10.6.jar' -it -xsl:.\saxon-newline-test1.xsl -o:saxon-newline-test1-xslt-ee10.6.txt the resulting file seems to have only LF characters (i.e. &#10;) at the line breaks.

Running on Windows with "OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_292-b10)".

Is there something wrong in my attempt above?


Replies (2)

RE: Does saxon:newline work? - Added by Michael Kay over 2 years ago

This parameter is designed only to work with the text output method.

RE: Does saxon:newline work? - Added by Martin Honnen over 2 years ago

Ah, that explains why my attempts with XSLT and XQuery using method xml all failed.

    (1-2/2)

    Please register to reply