Subject: Re: [xsl] JSON-encoding strings in XSLT 2.0 From: Michael Kay <mike@xxxxxxxxxxxx> Date: Tue, 29 Oct 2013 09:37:52 +0000 |
There's no built-in function for the job, but picking out the characters = that need special treatment (e.g. replacing newline by "\n") isn't = difficult. Handling astral characters is a bit tricky because JSON = requires them to be represented as a surrogate pair, but again the logic = for that isn't really difficult. Michael Kay Saxonica On 29 Oct 2013, at 00:56, Martynas JuseviD ius <martynas@xxxxxxxxxxxx> wrote: > Hey, > > is there some way in XSLT 2.0 to encode strings for use in JSON? In my > case, the stylesheet has to encode all text nodes in a XHTML fragment > which then gets passed to WYSIWYM editor constructor. Could this be > done as identity transform? > > I had solved this problem when I used XSLT 1.0 on PHP by calling > json_encode() as extension function, but now I'm in the Java world. > http://php.net/manual/en/function.json-encode.php > > Martynas > graphityhq.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] JSON-encoding strings in XSLT, Martynas Jusevičius | Thread | Re: [xsl] JSON-encoding strings in , Martynas Jusevičius |
Re: [xsl] Applying schemas and tran, Michael Schäfer | Date | Re: [xsl] JSON-encoding strings in , Martynas Jusevičius |
Month |