Re: [xsl] Problem with XSL and Namespace

Subject: Re: [xsl] Problem with XSL and Namespace
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 15 Oct 2002 18:13:04 +0100
Hi Giovani,

> But, if I define in the "mother" stylesheet this
> <xsl:stylesheet version="1.0"
> xmlns:xsl="";
> xmlns:axsl="";>
>         <xsl:namespace-alias stylesheet-prefix="axsl"
> result-prefix="xsl"/>
>         <axsl:template match="/">
>                 <root xmlns:xlink="";>
>                         ...
>                       <node>
>                         <ref xlink:href="#products"/>
>                       </node>
>                         ...
>                 </root>
>         </axsl:template>

I wouldn't expect you to get anything out of that stylesheet. The
'template' is in the alias namespace, not the XSLT namespace, so the
template should be treated like any other data element at the top
level of the stylesheet. Are you sure that's the 'mother' stylesheet
that you're using?

> the result XSL in "son" stylesheet is:
> <axsl:stylesheet xmlns:axsl="";
> xmlns:xlink="";
> xmlns:xsl=""; version="1.0">
>    <axsl:template match="/">
>       <root>
>                 ...
>               <node>
>                         <ref xlink:href="#products"/>
>               </node>
>                 ...
>         </root>
>    </axsl:template>
> The namespace xmlns:xlink=""; was retired of
> "root" element and put in "stylesheet" element.
> Why? 

Maybe because it doesn't matter where the namespace is declared --
there's still a namespace node for the XLink namespace on the <root>
element. My guess is that your *actual* 'mother' stylesheet has the
XLink namespace declared on the <xsl:stylesheet> element as well as on
the <root> element and that Saxon is just omitting the duplicated
namespace declaration.

> So, the final XML document generated is:
> <root>
>         ...
>       <node>
>                 <ref xlink:href="#products"/>
>       </node>
>         ...
> </root>

Really? That's very strange, because when I try your 'son' stylesheet
above with Saxon 6.5.2 I get:

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

as expected. Can you check your results again?



Jeni Tennison

 XSL-List info and archive:

Current Thread