Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

xsl does not work if input xml has attributes

 
manish ahuja
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 --------------

---------------------- THIS DOES NOT WORK --------------
<header xmlns="http://www.vignette.com/xmlschemas/importexport" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vignette.com/xmlschemas/importexport 7202/packageBody.xsd">...
<instances>
<instance>...</instance>
<instance>...</instance>
...
<instance>...</instance>
</instances>
</header>
---------------------- THIS DOES NOT WORK --------------


The xsl code we are using very similar to one found on this location
--------------------------
http://www.biglist.com/lists/xsl-list/archives/200407/msg00949.html
--------------------------

Do post your suggestions on the same.


Regards,
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the problem is not that the root element contains attributes, but that it contains namespace declarations. (And perhaps declaring a default declaration is the problem.) So that is where I think you need to look.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic