[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Effect of default namespace specifications on imports

Subject: Re: [xsl] Effect of default namespace specifications on imports
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 25 Oct 2012 12:04:54 -0400

At 2012-10-25 16:29 +0100, Ihe Onwuka wrote:
I am writing an XML conversion, part of which entails bringing things
into the new namespace (from no namespace).

I have specified namespace X as my default namespace and my XPath
default namespace but all is not as expected.

I doubt that will work for you. Your input is in no namespace so any addressing you need of the input must be in no namespace, so the XPath default namespace should not be set to anything.

I suspect it is because some elements are handled by an imported
identity template. Although this can be worked around this represents
an opportunity to get some clarification as to what the precise rules
are as relates to default namespace specfications and imported

There are no such rules regarding a relationship between default namespace specifications and imported stylesheets. Each stylesheet fragment is standalone. Any use of the XML default namespace or the XPath default namespace is in scope of only the stylesheet fragment. There is no knowledge between stylesheet fragments of the use of the namespaces in other fragments.

And I suspect the identity template will not help you if you have to change the namespace for each element.

When changing elements only by changing their namespaces, you need to reconstitute each element. I did this recently in a post on another thread:


... where you can see I'm changing the namespace and hardwiring the poster's choice of prefix for that namespace.

I hope this helps.

. . . . . . . . . Ken

Contact us for world-wide XML consulting and instructor-led training
Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/s/
G. Ken Holman                   mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal

Current Thread