Subject:Studio not recognizing CrLf Author:John Wollner Date:22 Mar 2005 09:54 AM
I have a template to insert a <br> for each CR/LF sequence in the data.
I have yet to get this working, although it is a simple process in
theory. When I debug the "break" template, it appears that the processor
is unable to see the CR LF, although a search of the data in a text editor
finds the sequence w/ no problem.
Subject:Studio not recognizing CrLf Author:Tony Lavinio Date:22 Mar 2005 10:42 AM
You can't solve it the way you want to.
According to http://www.w3.org/TR/REC-xml/#AVNormalize any literal
linefeed (
) or carriage-return (
) characters in attributes
are normalized to spaces before an XSLT engine ever sees them, by
a standards-compliant XML parser. So in XSLT you will never see the
linefeeds you are expecting. And for further reference, that same
XML parser will normalize 
 to 
 so you only need to
test for the linefeed in your code. For details see http://www.w3.org/TR/REC-xml/#sec-line-ends
You have a couple of options at least:
1. Change the emitting logic to send out entities
2. Use Convert-to-XML to parse the input and then send it to your XSLT
Subject:Studio not recognizing CrLf Author:Tony Lavinio Date:22 Mar 2005 11:51 AM
Even though it is in XML, you could parse it as raw text if you really
care about the line endings, and that's pretty much your only option if
you can't change the input XML (or at least get it out of the attributes.)
But no XSLT engine can see plain line endings in attributes.
Subject:Studio not recognizing CrLf Author:Ivan Pedruzzi Date:22 Mar 2005 02:56 PM
John,
Your input document is not very well designed.
XML attributes are suppose to hold a small text like a date or an ID.
Attribute value gets also normalized replacing EOL with space when the XML is parsed.
If you have control on your input the best would be having those long text hold by elements.
Prepocessing the raw text to replace EOL with <br/> is not an option
becaue you will end up having not well formed XML (tag inside attribute value)
Unless you replace EOL with some special string liek WIN_EOL then when processing
the XML replace WIN_EOL with <br/>
In XSLT 2 you can create pre-process step like the following