Hello,
I have got a problem with Xalan. When I try to transform the xml document
(1) with the stylesheet (2) Xalan produces
the resulting xml document (3). It forgets the attribute xsi:schemaLocation
and instead produces ="" in the <root>-element.
This is not valid xml!! Could someone please tell me why this does happen?
Is anything wrong with the xsl template?
I call Xalan as follows and use version 2.2.0-dev:
StreamSource stylesheet=new StreamSource("file:///d:/Addpar2.xsl");
Transformer transformer=TransformerFactory.newInstance().newTransformer(stylesheet);
transformer.transform(new StreamResult("file:///d:/input.xml"), new
StreamResult("file:///d:/output.xml"));
Regards, Bjoern.
(1)
<root xmlns="http://sunshine.sundn.de/sunflow/Example1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://sunshine.sundn.de/sunflow/Example1 file:///d:/Example1.xsd">
...
</root>
(2)
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://sunshine.sundn.de/sunflow/Example1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
<xsl:template match="*|text()">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates select="*|text()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
(3)
<root ="" xmlns="http://sunshine.sundn.de/sunflow/Example1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
</root>