[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] JSON strings in XML attributes

Subject: Re: [xsl] JSON strings in XML attributes
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Wed, 29 Aug 2012 21:35:29 +0100

Is there a way to tell an XSLT 2 processor to serialize attribute delimiters as single quotes and keep double quotes unescaped in attribute values?

There's no standard way of doing it, and no extension in Saxon, but the Saxon serializer is fairly easy to customize: subclass SerializerFactory with an override of newXMLEmitter() to create a subclass of XMLEmitter; in your subclass of XMLEmitter, override writeAttribute() and writeEscape().

Michael Kay

Current Thread