Open Pierre-de-la-Verre opened 2 years ago
See White space Handling in the XML specification. In this case you may need to use the xml:space="preserve"
attribute.
Thanks, but I failed while trying. Can someone give a simple example?
Actually I cannot reproduce your problem, there must be something else going on, did the XLST perhaps not honor your request? When I create the attached XML file containing tabs and newlines:
<?xml version="1.0" encoding="utf-8"?>
<root>
KEY_NUMERIC_OLD KEY_NUMERIC_NEW
KEY_NUMERIC_OLD KEY_NUMERIC_NEW
KEY_NUMERIC_OLD KEY_NUMERIC_NEW
KEY_NUMERIC_OLD KEY_NUMERIC_NEW
</root>
And load it in XML notepad the root element contains this formatted text, nothing changed, when I save the document again the file on disk is still correct, no loss of tabs or newlines in this block of text.
I want to refresh this topic and attach 4 files - one original and 3 derivates:
1) using_tab_codes.xslt: original XSLT, using text with "&#...;"
2) using_tab_codes_xmlint.xslt: created with xmlint.exe -e utf-8 -f -nobom %1; all "&#...;" are gone
3) using_tab_codes_new_no.xslt: opened and saved with XMLNotepad, "Preserve whitespace: no"; all "&#...;" are gone
4) using_tab_codes_new_saved.xslt: opened and saved with XMLNotepad, "Preserve whitespace: yes"; all "&#...;" are replaced with TAB and CR/LF
I'm not sure if 2) and 3) are doing it right ..
I have a XSLT-file which contains TAB and CRLF-definition to create a better readable output, like this
It works fine, but when I opened the file with XMLNotepad and saved it, all the TABs and CRLF are gone. Why? Related to #166 ?