[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: problem adding namespace node

Subject: RE: problem adding namespace node
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 28 Feb 2006 17:05:42 -0000
add namespace to aspx
The processor is unlikely to generate <p:a/> unless there is a namespace
declaration for p in scope. I suspect you are trying to add not a namespace
node, but a namespace declaration. It there a namespace declaration already
present on an outer node? The serializer will always eliminate redundant
namespace declarations.

Perhaps you are even trying to change the namespace of the p:a element. When
you create an element, you define its expanded name (namespace URI and local
name), and creating namespace nodes will never change the name of the
element.

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: Majirus FANSI [mailto:jmfansi@xxxxxxxxxxx]
> Sent: 28 February 2006 16:58
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  problem adding namespace node
>
>
> 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:  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-fr

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.