[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: LF and serialize()?

Subject: Re: LF and serialize()?
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 25 Oct 2019 15:11:44 -0000
Re:  LF and serialize()?
The newline characters are destroyed by the XML parser long before the XSLT
processor gets to see the data, under the rules for Attribute Value
Normalization. Heaven only knows who thought that was a good idea, but you
can't change it. (It's a wretched nuisance when you use multiline XPath
expressions in a stylesheet.)

Michael Kay
Saxonica

> On 25 Oct 2019, at 14:04, Birnbaum, David J djbpitt@xxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Dear XSL-List,
>
> When I run serialize() (in Saxon-HE 9.9.1.4J XSLT) over an XML snippet, it
does what I need, except that it replaces LF inside attribute values with SP.
This seems to be consistent with what I read at
https://www.w3.org/TR/REC-xml/#AVNormalize, and the workaround described there
(use a numerical character reference to LF instead of the raw LF character)
works. But Ibd like to avoid having to specify in the XML something that I
would prefer to manage during the XSLT transformation, and I would also like
to avoid pre-processing the XML outside an XML environment and replacing the
LF with a numerical character reference there, before passing the modified XML
into the XSLT transformation.
>
> So: Would anyone happen to know of a way within just an XSLT stylesheet to
retain LF within an attribute value as distinct from SP in the output of
serialize()?
>
> Thanks,
>
> David
> djbpitt@xxxxxxxxx

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.