The XSL used to do conversion is
<?xml version='1.0' ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<root xmlns:p1="http://www.w3.org/2001/XMLSchema-instance">
<Companyname>
<xsl:value-of select="root/name"/>
</Companyname>
<Companyid>
<xsl:value-of select="root/id"/>
</Companyid>
<Empdesg>
<xsl:value-of select="root/desg"/>
</Empdesg>
</root>
</xsl:template>
</xsl:stylesheet>
But the output xml is empty.
But if we have namespace prefix in smaple input as below, we get proper output.
<?xml version="1.0"?>
<root xmlns:p1 = "http://www.w3.org/2001/XMLSchema-instance">
<Companyname>String</Companyname>
<Companyid>12</Companyid>
<Empdesg>Str</Empdesg>
</root>
The problem is that our application will not generate namespace prefix and hence our output is empty.
Please let us know how this can be solved so that we get the output if our input xml doesnt has namespace prefix.
Subject:Regarding XML namespace prefix in input xml for XSL transformation Author:(Deleted User) Date:15 Nov 2007 08:24 AM
Hi Amith,
if the input XML has a xmlns="..." attribute, it means that the elements are in that namespace (even if I find strange that the namespace is a reserved one, usually associated with the xsi prefix), so you should write the XPath queries as p1:root/p1:xxxx
Let us know wether it is a bug with the XML and it should be changed for XSL to work?
If this problem can be solved without changing the input xml, let us know how can we do it in the XSL.
Even if we specify XPath queries as p1:root/p1:xxxx, our input xml doesnt has p1 prefix only.
As we are pretty new to XSL, please help us in updating the XSL so that we get the output