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

JSON strings in XML attributes

Subject: JSON strings in XML attributes
From: "Imsieke, Gerrit, le-tex" <gerrit.imsieke@xxxxxxxxx>
Date: Wed, 29 Aug 2012 19:23:14 +0200
 JSON strings in XML attributes
The hipsters at Amazon had the brilliant idea to cram JSON into HTML attributes in their KF8 format, such as in
<a class="app-amzn-magnify" data-app-amzn-magnify='{targetId:"fs1-txt2-magTarget", sourceId:"fs1-2-txt", ordinal:1}'>


(Using a distinct custom attribute for each property in the flat JSON structure apparently wasnt an option for them.)

Since
 we are using XSLT to generate the HTML,
 strings in JSON have to be double-quote-delimited,
 the KF8 renderer apparently doesnt parse &#34; to ",
 our XSLT processor uses double quotes as attribute delimiters by default:

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? Otherwise, wed have to resort to some string postprocessing of the serialized XML.

Gerrit

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.