Altova Mailing List Archives
>xsl-list Archive Home
>Recent entries
>Thread Prev - Re: [xsl] problem adding namespace node
>Thread Next - RE: [xsl] problem adding namespace node
Re: [xsl] problem adding namespace node
To:
Date: 2/28/2006 4:58:00 PM
Hi ken,
thank you for replying.
I did try <xsl:copy-of select="xalan:nodeset($dummy)/*/namespace::p"/>.
But the situation remains the same. No namespace created. I have tried both
with xalan 2.6.0 and saxon 8. The result is the same: only <p:a/>, without
namespace declaration.
any other tips are welcome.
Regards,
Majirus
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] problem adding namespace node
Date: Tue, 28 Feb 2006 11:28:25 -0500
At 2006-02-28 16:39 +0100, Majirus FANSI wrote:
Should anyone knows how to add a namespace to a node?
i have tried the following approach:
first, i create a dummy attribute;
<xsl:variable name="dummy">
<xsl:element name="p:a" namespace="http://majirus.org"/>
</xsl:variable>
From an xml node <a>, i write the following instruction:
<a><xsl:copy-of select="xalan:nodeset($dummy)/*/namespace::*[2]"/><a>
but, as a result tree i have got only the <a/> element without namespace,
Perhaps because you are addressing the namespace by its position, which is
processor dependent ... you cannot rely on the order of namespace nodes.
This is something my students find hard to understand: there *is* an
order, just that the stylesheet writer cannot rely on what the order is.
Did you try:
<xsl:copy-of select="xalan:nodeset($dummy)/*/namespace::p"/>
I think it would be cleaner if you had in your stylesheet:
<xsl:stylesheet xmlns:p="http://majirus.org">
then you could do:
<xsl:copy-of select="document('')/*/namespace::p"/>
I hope this helps.
. . . . . . . . . . . Ken
--
Upcoming XSLT/XSL-FO hands-on courses: Washington,DC 2006-03-13/17
World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05 http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
_________________________________________________________________
10 Mo pour vos pihces jointes avec MSN Hotmail !
http://www.imagine-msn.com/hotmail/default.aspx?locale=fr-frDisclaimer
These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

