Project

Profile

Help

Support #5225

open

While using xslt 3.0 function "xml-to-json" would like to avoid escaping '/'

Added by Juhi Gupta about 2 years ago. Updated over 1 year ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
Start date:
2022-01-24
Due date:
% Done:

0%

Estimated time:
Applies to JS Branch:
Fix Committed on JS Branch:
Fixed in JS Release:
SEF Generated with:
Platforms:
Company:
-
Contact person:
-
Additional contact persons:
-

Description

We are trying to convert xml to json, while using function "xml-to-json" it is trying to escape '/' by adding '' before it. We would like to avoid doing that and translate as is.


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns="http://www.w3.org/2005/xpath-functions"
  xmlns:func="http://ingka.ikea.com/"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
	version="3.0">


  <xsl:output method="text"/>

  <xsl:template match="/">
    <xsl:variable name="transformed-xml">      
      <xsl:call-template name="SamplBody" />
      <xsl:copy-of select="/map"/>
    </xsl:variable>
    <xsl:value-of select="xml-to-json($transformed-xml, map { 'indent' : true() })"/>   
  </xsl:template>

    <xsl:template name="SamplBody" >
    <map>
        <string key="SamplString">n/a</string>
    </map>
  </xsl:template>	
  
  </xsl:stylesheet>

and the result of this xslt is


  { "SamplString" : "n\/a" }

We would like the result to look like


  { "SamplString" : "n/a" }

Can you suggest a solution for this?

Please register to edit this issue

Also available in: Atom PDF Tracking page