Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

output method="text" -> No Linebreaks are displayed. Why?

saxon-help
RonaldK6
2013-05-15
2013-05-15
  • RonaldK6
    RonaldK6
    2013-05-15

    No matter what I do, the output of the Saxon Transformer is always just one single line of text.
    I of course use xsl:output method="text" but even If I just want to output
    Line 1
    [Linebreak]
    Line 2

    it appears as:
    Line 1 Line 2

    Why? What am I doint wrong?

     
  • Michael Kay
    Michael Kay
    2013-05-15

    We can't tell what you are doing wrong if you don't tell us what you are doing. Show us some code, and we'll help you find the bugs in it. Isolate it to as small a sample as possible to make our job easier.

    Also tell us how you are viewing the text. What you see on the screen is not always the same as the bytes stored on disk.

     
  • RonaldK6
    RonaldK6
    2013-05-15

    Well, you are right ;-)

    I have an XML-File which is not iportant, because in my example don't even fill the created textfile with data from the xml.

    I attached the text.xsl file to this post where I just want to output two lines of plain text.
    I found out that not even this is done correctly (after I had a much more complicated sample which didn't show any linebreaks either).

    Then I start the Transformation with this line:
    Transform -t -s:text.xml -xsl:text.xsl -o:output.txt

     
    Attachments
  • RonaldK6
    RonaldK6
    2013-05-15

    Sorry, I forgot: The output is the file "output.txt", which I attached to this post.

     
    Attachments
  • Michael Kay
    Michael Kay
    2013-05-15

    Attached is a screenshot of your output.txt as it appears on my screen. The line endings are there. Perhaps you are viewing it in a web browser as if it were HTML?

     
    Attachments
  • RonaldK6
    RonaldK6
    2013-05-15

    Freaky! No, I use the "normal" Texteditor ("Editor.exe") from Windows.

     
  • RonaldK6
    RonaldK6
    2013-05-15

    Interesting: When I add a Linkebreak manually in the output.txt and compare it to it's original version, WinMerge tells me that the linebreaks are in a different format
    "(DOS/UNIX/MAC)"

    Is there a way to create "DOS" Linebreaks with xsl?

     
  • Michael Kay
    Michael Kay
    2013-05-15

    The line endings in the file are NL characters (x0A). Saxon outputs what it finds in the stylesheet, which after normalization by the XML parser is typically NL. If you want the Windows CRLF line ending you need to generate it explicitly, that is, output & #x0d;& #x0a; Most modern software is happy to accept either form.

     
  • RonaldK6
    RonaldK6
    2013-05-15

    This is what I was looking for! Thank you very much!