I'm trying to use an XSL to tranform a DOM tree which was programaticly created.
which goes appr. like this:
DOMImplementation impl = documentBuilder.getDOMImplementation();
this.document = impl.createDocument(NAMESPACE, "objects",
impl.createDocumentType("objects", DOCUMENTTYPE_PUBLIC,
DOCUMENTTYPE_SYSTEM));
this.document.getDocumentElement().setAttribute("xmlns", NAMESPACE);
To test the XSL I serialize the XML first with a 'copy.xslt',
<xsl:template match="*">
<xsl:copy-of select="." />
</xsl:template>
which produces an XML like this:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<objects xmlns="http://www.mmbase.org/objects" cloud="mmbase">
<object id="581" otype="53" type="xmlnews">
etc...
Using this file as input for xalan or xsltproc, this work as I expect:
<xsl:template match="o:objects">
<div class="objects">
<xsl:apply-templates select="./o:object[1]" />
</div>
</xsl:template>
But if then I don't use this intermediate file, but feed the Document
directory into the transformer, i have to ignore namespaces after the
first match:
<xsl:template match="o:objects">
<div class="objects">
<xsl:apply-templates select="object[1]" />
</div>
</xsl:template>
I completely don't understand this. Why is my inner element of a
different namespace, and why was this not reflected in my
serialization?
Michiel
--
mihxil' http://mihxil.komputilo.org/
nl_NL eo_XX en_US