Project

Profile

Help

Support #3230 » serialize-json.serialize.xsl

Nick Nunes, 2017-05-23 21:32

 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="3.0">
<xsl:variable name="output-serialization-parameters" as="element()">
<output:serialization-parameters
xmlns:output="http://www.w3.org/2010/xslt-xquery-serialization">
<output:method value="json"/>
<output:build-tree value="no"/>
<output:use-character-maps>
<output:character-map character="/" map-string="/"/>
</output:use-character-maps>
</output:serialization-parameters>
</xsl:variable>
<xsl:template name="main">
<xsl:variable name="json" as="element()">
<map xmlns="http://www.w3.org/2005/xpath-functions"><string key="href">/an/href</string></map>
</xsl:variable>
<xsl:sequence select="serialize(parse-json(xml-to-json($json)),$output-serialization-parameters)"/>
</xsl:template>
</xsl:stylesheet>
(3-3/3)