[xsl] Fwd: Your posting to XSL-List

Subject: [xsl] Fwd: Your posting to XSL-List
From: "VISHNU SINGH svishnu.singh4@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 21 Jul 2018 15:33:44 -0000
Hi Experts,

I need to print a newline character in text file generated from XSLT. I
have to use this text output in SAP environment. As per my understanding we
have to use &#xD;&#xA; for this.

Below is the XSLT 2.0 code that i am using but it is not giving me the
required output:-

<?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"; exclude-result-prefixes="xs" version="2.0"
>

    <xsl:character-map name="nl">
        <xsl:output-character character="&#xD;" string="&#xD;"/>
    </xsl:character-map>

    <xsl:output method="text" use-character-maps="nl"/>

    <xsl:variable name="line1" select="'This is first line'"/>
    <xsl:variable name="line2" select="'This is second line'"/>
    <xsl:variable name="line3" select="'This is second line'"/>
    <xsl:variable name="line4" select="'This is second line'"/>

    <xsl:template match="/">
        <xsl:value-of select="$line1"/>
        <xsl:text>&#xD;&#xA;</xsl:text>
        <xsl:value-of select="$line2"/>
        <xsl:text>&#xD;&#xA;</xsl:text>
        <xsl:value-of select="$line3"/>
        <xsl:text>&#xD;&#xA;</xsl:text>
        <xsl:value-of select="$line4"/>
        <xsl:text>&#xD;&#xA;</xsl:text>
    </xsl:template>

</xsl:stylesheet>

We can test the generated output at https://www.onlinehexeditor.com/ and it
should show the two hexacode 0d 0a instead it is showing only 0a.

I have a text file of expected output that i have checked online and
showing the hexacode 0d 0a which is fine and i need the same using xslt.

I have also attached the snapshot of the online test that I actually need.

Please suggest!

Best Regards,
Vishnu






-- 
Vishnu Singh | http://marklogicgd.blogspot.in/




======================================================================
B. Tommie Usdin                        mailto:btusdin@xxxxxxxxxxxxxxxx
<btusdin@xxxxxxxxxxxxxxxx>
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                           Phone: 301/315-9631
Suite 207                                    Direct Line: 301/315-9634
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in XML and SGML

======================================================================

Current Thread