Re: [xsl] Namespace conflicts processing Word documents

Subject: Re: [xsl] Namespace conflicts processing Word documents
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 6 Oct 2008 14:23:57 +0100
> Is this correct, or have I missed something?

The namespace prefix mapping is (conceptually at least) handled by the
xml parser, with xml document scope, before XSLT even sees the
stylesheet, so you are correct that you can not just have different top
level files binding this.

If the stylesheet that you want to import has a w: prefix but no
declaration for w: then it is not namespace well-formed so it dies, just
as if it had other well formededness errors such as missing close tags,
the error will come form the XMl parser (eg xerces) not the XSLt system
(eg saxon/xalan).

Probably the cleanest solution is to do a two pass transformation 
that just (for WordML) does a "modified identity transform" that just
mapes the namespaces to the ooxml ones (and does any other changes
needed) then just do a ooxml transform in the main stylesheet.

If you are sure that you _only_ want to switch namespaces and not make
any other changes, you can do other things such as make your stylesheet
have xmlns:w="&w-ns;"
and then arrange that w-ns resolves to the right namespace depending on
your processing context.


The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 

Current Thread