Subject:xsl does not work if input xml root element has attributes Author:Sushant Prabhu Date:11 Apr 2007 09:35 AM
Hi All,
Currently we are using a xsl piece of code we found on the internet for breaking a huge xml into smaller files.
This code works fine but it works only when the root xml element has no attributes. The code fails to render the output wehn the input xml file has an xml root element with attribute.
To illustrate the code works fine if I have the following input xml
---------------------- THIS WORKS --------------
<header>...
<instances>
<instance>...</instance>
<instance>...</instance>
...
<instance>...</instance>
</instances>
</header>
---------------------- THIS WORKS --------------
Subject:xsl does not work if input xml root element has attributes Author:(Deleted User) Date:11 Apr 2007 10:09 AM
Hi Sushant,
I think the problem is not that the header has attributes, but that it has a xmlns="..." namespace declaration.
In this case, you cannot just specify an XPath expression like "/header", but you need to use the proper namespace prefix (e.g. "/p:header" where "p" is defined by a xmlns:p="..." attribute of the xsl:stylesheet element).