Namespace conflicts processing Word documents
WordML and OOXML files (Word saved-as-XML from vv2003-2008) contain some different namespace declarations for the same prefix (specifically w: but a few others).
On the surface, this appears to mean that an XSLT file written to process WordML files' w:* elements cannot be used to process OOXML files' w:* elements -- two parallel versions are needed, one with the WordML w: namespace and one with the OOXML w: namespace.
As the only document body elements in either case that I will need to handle are identified by named styles, I would prefer to be able to reuse the bulk of the templates by inclusion or importation. The documents come from mixed sources, and I'd prefer not to have to ask the authors to update their version of Word :-)
I tested this by creating two "driver" XSLT files, one implementing the WordML namespace declarations and one the OOXML ones; with both files having a single xsl:import or xsl:include (tested both ways) calling my file of templates which itself declared no namespaces except XSL.
Both Saxon and xalan throw an error, saying that the namespace w: was undeclared in all cases.
This makes it appear that namespaces cannot be inherited from an outer XSLT file to an included or imported one; in effect that the omission of namespace declarations on the included/imported xsl:stylesheet element nullifies all outer namespace declarations.
Is this correct, or have I missed something?
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format