I have tried to put namespaces in the dtd, create a dom 2 comform tree,
change the xsl file, still the same result: it works perfectly if I first
write the dom tree into a stream and read it from there. I don't think the
missing namespace was the problem. As I have described this if I use
document.getDocumentElement() as a parameter to the DOMSource instead of just
document, all child targets are found.
The situation is:
xsl file on hdd
...
<xsl:template match="/">
match /
<br/>
<xsl:apply-templates select="prefix:RootElement"/>
</xsl:template>
<xsl:template match="prefix:RootElement">
match RootElement
<br/>
<xsl:apply-templates select="prefix:Child_1"/>
<br/>
<xsl:apply-templates select="prefix:Child_2"/>
<br/>
<xsl:apply-templates select="prefix:Child_3"/>
</xsl:template>
<xsl:template match="prefix:Child_1">
match Child_1
</xsl:template>
<xsl:template match="prefix:Child_2">
match Child_2
</xsl:template>
<xsl:template match="prefix:Child_3">
match Child_3
</xsl:template>
...
xml file printed by the application for test purposes
...dtd declaration...
<prefix:RootElement xmlns:prefix="...">
<prefix:Child_1>...</prefix:Child_1>
<prefix:Child_2>...</prefix:Child_2>
<prefix:Child_3>...</prefix:Child_3>
</prefix:RootElement>
(the dtd is now build with namespaces, prefixes, everything, the
generated xml is valid and internet explorer is doing the transformation
correctly and also xalan is doing it correctly if I use a stream)
case 1)
java transformation code
transformer.transform( new DOMSource( document ), new
StreamResult( stream ) );
html the result of the transformation
match /
case 1)
java transformation code
transformer.transform( new DOMSource(
document.getDocumentElement() ), new StreamResult( stream ) );
html the result of the transformation
match Child_1
match Child_2
match Child_3
case 3) what I wish:
java transformation code
transformer.transform( new StreamSource( inputStream ), new
StreamResult( outputStream ) );// this is just a workaround
html the result of the transformation
match /
match RootElement
match Child_1
match Child_2
match_Child_3
Regards Daniel Jian