I'm getting a JSON
object back from the API and converting that into XML which is all working okay, however when I try to use that converted object and wrapped it in XSL its not rendering any values in the HTML.
Can I do it something like this?
var x2js = new X2JS();
var json2XMLResult = x2js.json2xml_str(data.Results);
this.da = '<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="../../../config/Customer.xsl" type="text/xsl" ?> <Results>' + json2XMLResult + '</Results>';
and rendering it using document.getElementById().innerHTML
(<HTMLInputElement>document.getElementById('xmlJson')).innerHTML = this.da;
my XSL file:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"
doctype-system="about:legacy-compat"
encoding="UTF-8"
indent="yes" />
<xsl:template match="/">
Account No. is - <xsl:value-of select="./Results/AccountNumber"/>
Last Name is - <xsl:value-of select="./Results/LastName"/>
</xsl:template>
</xsl:stylesheet>
Can someone point me to the right direction, please. I've never worked on XML nor XSL before so I'm completely lost.
Checking the HTML source it's commenting out the <?xml>
tags.