Re: [xsl] How to unescape slash character using xml-to-json ?

Subject: Re: [xsl] How to unescape slash character using xml-to-json ?
From: "Tim Thompson timathom@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 24 Oct 2019 00:25:35 -0000
Hi, Matthieu,

See Martin Honnen's answer here:

https://stackoverflow.com/questions/44610431/json-serialization-with-xpath-3-
1-fnserialize

Updated example: https://xsltfiddle.liberty-development.net/bwdwrV/2


--
Tim A. Thompson
Discovery Metadata Librarian
Yale University Library

On Wed, Oct 23, 2019 at 6:59 PM Matthieu RICAUD-DUSSARGET
m.ricaud-dussarget@xxxxxxxxxxxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Hi all,
>
>
>
> I need to generate this json output :
>
>
>
> {"test":"foo/bar"}
>
>
>
> I use XSLT3 function fn:xml-to-json to do this.
>
> My input is :
>
>
>
> <fn:map xmlns:fn="http://www.w3.org/2005/xpath-functions";>
>
>     <fn:string key="test" escaped="false">foo/bar</fn:string>
>
> </fn:map>
>
>
>
> But I always get this result with escaped slash :
>
>
>
> {"test":"foo\/bar"}
>
>
>
> Reading the spec at https://www.w3.org/TR/xslt-30/#func-xml-to-json at
> paragraph bStrings are escaped as follows:b it looks like I canbt
unescape
> b/b (solidus?) character.
>
>
>
> Is there really no way to do that using XSLT3  json functionality ? Did I
> missed something obvious ?
>
>
>
> Here is a running test : https://xsltfiddle.liberty-development.net/bwdwrV
>
>
>
> Thanks in advance,
>
>
>
> *Cordialement,*
>
> *Matthieu RICAUD-DUSSARGET*
>
> Expert XML
> SI EDITORIAL
>
> TC)l. +33 6 63 25 95 58
> 80, avenue de la Marne 92120 Montrouge
>
>
>
>
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/885568> (by
> email <>)

[demime 1.01d removed an attachment of type image/jpeg which had a name of image002.jpg]

Current Thread