My Input XML payload :
<d:table xmlns:d="http://abc/xyz/d" xmlns:m="http://abc/xyz/m" m:type="abc.xyz.123">
<d:name m:type="Edm.String">African Coffee Table</d:name>
<d:width m:type="Edm.Boolean">true</d:width>
<d:height m:type="Edm.Double" >120.50</d:height>
<d:area m:type="Edm.Double" >120.50</d:area>
<d:volume m:type="Edm.Double" >120.50</d:volume>
<d:cube m:type="Edm.Double" >120.50</d:cube>
<d:length m:type="Edm.Double" >120.50</d:length>
</d:table>
Output expected in JSON :
{
"table": {
"abc.xyz.123"
"name": {
"type": "Edm.String",
"content": "African Coffee Table"
}
"width": {
"type": "Edm.Boolean",
"content": "true"
}
"length": {
"type": "Edm.Double",
"content": "120.50"
}
}
}
MY XSLT code :
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:d="http://abc/xyz/d" xmlns:m="http://abc/xyz/m">
<xsl:output method="text"/>
<xsl:variable name="newline">
<xsl:text>
</xsl:text>
</xsl:variable>
<xsl:template match="/">
<xsl:text>
<table>
</xsl:text>
<xsl:value-of select="$newline"/>
<xsl:for-each select="/d:table">
<xsl:value-of select="$newline"/>
</xsl:for-each>
<xsl:for-each select="/d:table">
<xsl:text>
<table>
</xsl:text>
<xsl:value-of select="d:table"/>
<xsl:text>
</table>
</xsl:text>
<xsl:value-of select="$newline"/>
<xsl:text>
<width>>
</xsl:text>
<xsl:value-of select="d:width"/>
<xsl:text>
</width>
</xsl:text>
<xsl:text>
<length>>
</xsl:text>
<xsl:value-of select="d:length"/>
<xsl:text>
</length>
</xsl:text>
</xsl:for-each>
<xsl:text>
</table>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
I need to map xml payload such that the actual value of tag is added inside content tag and data type is mapped under type.
I will use XML to JSON to convert the transformed XML in to JSON
but as of now i am not able to convert the XML payload into the expected XML out
Please help
Thanks in Advance