xsl-list
[Top] [All Lists]

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

2012-10-25 11:10:23
On Thu, Oct 25, 2012 at 5:04 PM, G. Ken Holman
<gkholman(_at_)cranesoftwrights(_dot_)com> wrote:
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.


Of course ..... silly me. Doh!!

I recently had to remind myself that re-namespacing is effectively
renaming so will peruse the other thread but first I will see how far
the aforesuggested adjustment gets me.



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
stylesheets.


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:

  http://markmail.org/message/mah6pm52trp4cqrm

... 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(_at_)CraneSoftwrights(_dot_)com
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--