[Home] [By Thread] [By Date] [Recent Entries]
Am 25.10.2019 um 15:08 schrieb Martin Honnen martin.honnen@xxxxxx:
Am 25.10.2019 um 15:04 schrieb Birnbaum, David J djbpitt@xxxxxxxx: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. To illustrate, this XSLT snippet with XSLT 3 constructs some XML with an attribute value containing line feeds and Saxon, when using the "serialize" function, rightly then escapes them as numeric character references, so B B B <xsl:variable name="xml-snippet">
B B B B B B B <element>
B B B B B B B B B B B <xsl:attribute name="att1">Line 1.
Line 2.
Line 3.</xsl:attribute>
B B B B B B B </element>
B B B </xsl:variable>
B B B <xsl:value-of select="serialize($xml-snippet, map { 'method' :
'xml' })"/>ouputs <element att1="Line 1.
Line 2.
Line 3."/>
|

Cart



