RE: [xsl] Problem with XSL and Namespace

Subject: RE: [xsl] Problem with XSL and Namespace
From: "Giovani Librelotto" <grl@xxxxxxxxxxxx>
Date: Tue, 15 Oct 2002 17:50:15 +0100
Jeni and David,

I'm sorry. The xmlns="http://www.topicmaps.org/xtm/1.0/"; attribute is a
mistake.
I'll redefine my problem.

I'm making a stylesheet for generate another stylesheet. I'm using Saxon
6.5.2.
I want to create a root element in the XML document final (generated by
the second stylesheet) with a
namespace xmlns:xlink="http://www.w3.org/1999/xlink"; like above:

<root xmlns:xlink="http://www.w3.org/1999/xlink";>

But, if I define in the "mother" stylesheet this

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias";>
	<xsl:namespace-alias stylesheet-prefix="axsl"
result-prefix="xsl"/>
	<axsl:template match="/">
		<root xmlns:xlink="http://www.w3.org/1999/xlink";>
	 		...
		      <node>
            		<ref xlink:href="#products"/>
		      </node>
	 		...
		</root>
	</axsl:template>

the result XSL in "son" stylesheet is:

<axsl:stylesheet xmlns:axsl="http://www.w3.org/1999/XSL/Transform";
xmlns:xlink="http://www.w3.org/1999/xlink";
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">

   <axsl:template match="/">
      <root>
 		...
	      <node>
           		<ref xlink:href="#products"/>
	      </node>
 		...
	</root>
   </axsl:template>

The namespace xmlns:xlink="http://www.w3.org/1999/xlink"; was retired of
"root" element and put in "stylesheet" element.
Why? 
So, the final XML document generated is:

<root>
	...
      <node>
    		<ref xlink:href="#products"/>
      </node>
	...
</root>

How can I to generate this?

<root xmlns:xlink="http://www.w3.org/1999/xlink";>
	...
      <node>
    		<ref xlink:href="#products"/>
      </node>
	...
</root>

Thanks in advance,

------------------------------------
Giovani Rubert Librelotto
Ph.D. Student
Universidade do Minho
Braga - Portugal
grl@xxxxxxxxxxxx



> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Jeni Tennison
> Sent: Tuesday, October 15, 2002 4:36 PM
> To: Giovani Librelotto
> Cc: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] Problem with XSL and Namespace
> 
> 
> Hi Giovani,
> 
> > the result XSL in stylesheet "son" is:
> >
> > <xstm:stylesheet xmlns:axsl="http://www.w3.org/1999/XSL/Transform";
> > xmlns:xlink="http://www.w3.org/1999/xlink";
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
> >
> >    <axsl:template match="/">
> >       <root xmlns="http://www.topicmaps.org/xtm/1.0/";>
> >
> > And in the final XML document generated is:
> >
> > <root>
> >   ..
> > </root>
> 
> If so, then your processor is buggy. Given the stylesheet 
> that you have above, the <root> element that's generated in 
> the output should have two namespace nodes on it, one for xlink
> (http://www.w3.org/1999/xlink) and one for the default 
> namespace (http://www.topicmaps.org/xtm/1.0/). In order to 
> retain those nodes when serialized, it should look like:
> 
> <root xmlns="http://www.topicmaps.org/xtm/1.0";
>       xmlns:xlink="http://www.w3.org/1999/xlink";>
>   ...
> </root>
> 
> Which processor are you using? If you simplified your example 
> (which I guess you did, given that the prefix for the 
> stylesheet element hasn't been declared), perhaps you can 
> show us the actual 'son' stylesheet that you're using and we 
> can see whether there's something in it that would cause the 
> namespace nodes to disappear.
> 
> Cheers,
> 
> Jeni
> 
> ---
> Jeni Tennison
> http://www.jenitennison.com/
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 
> 



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread