Gary L Peskin wrote:
> It's hard for me to tell from the code you've shown what went wrong. If
> you can, serialize the DOM and attach it to the list and I'll have a
> look. You can serialize this by adding this to your code:
The code of the serialized DOM is attached to this posting. It's binary,
I would like to know how you take a look at it.
> Also, I'm presuming that you're passing xslDoc to your transformation
> and not some other Node.
I'm passing xslDoc to the transformation with:
DOMSource xslDomSource = new DOMSource();
xslDomSource.setNode( xslDoc );
//Use the DocumentBuilder to parse the XML input.
Document xmlDoc = null;
try {
DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance();
dFactory.setNamespaceAware(true);
DocumentBuilder dBuilder = dFactory.newDocumentBuilder();
xmlDoc = dBuilder.parse("birds.xml");
} catch (ParserConfigurationException pce) { [...] }
DOMSource xmlDomSource = new DOMSource(xmlDoc);
DOMResult domResult = new DOMResult();
// and now the interesting part:
transformer.transform(xmlDomSource, domResult);
Before that I print out my data for debugging with:
Serializer serializer = SerializerFactory.getSerializer
(OutputProperties.getDefaultMethodProperties("xml"));
serializer.setOutputStream(System.out);
serializer.asDOMSerializer().serialize( xslDoc);
that works well. So I get e.g.:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" method="xml"/>
<xsl:template match="Order"><hr/></xsl:template>
</xsl:stylesheet>
Martin
dom.ser