Re: [xslt] Suppressing namespace attributes



On Wed, Jun 06, 2007 at 04:22:03PM +0200, Hans Guijt wrote:
> Hi,
> 
> 
> I am trying to generate a DocBook document from an XML document. The XML
> document contains a few tags of my own, which I have stuck in a namespace
> of my own, but I also embed a few DocBook tags since that is what I'm
> generating.
> 
> The problem I am facing is that xsltproc insists on first seeing a
> namespace declaration, "xmlns:ur='whatever'", for my own tags, but then
> applies that namespace declaration to the DocBook tags when writing the
> result document. However, I don't want _any_ namespace declarations to
> appear in my output document - it is 100% DocBook, no namespaces anywhere.

  the namespace prefix you define could be used by constructs outside
of the structure and the XSLT processor has absolutely no way to guess
whether this may impact the semantic of the output data. So as a rule
XSLT-1.0 requires all namespaces in scope to be copied. Declare the
namespace as an extension namespace that's the only way to avoid the
copying.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]