[xsl] Namespace question

Subject: [xsl] Namespace question
From: Ayelet Kotzer <akotzer@xxxxxxxxxxx>
Date: Wed, 03 Jan 2001 16:21:59 -0800
Ayelet Kotzer wrote:
> (Desired) Output:
>    <A >
>         <A1>something </A1>
>          <A2  att="att1>something </A2>
>     </A>
> What I got is something like this:
> <A1   xmlns:m="B">something </A1>
>   <A2  xmlns:m="B"  att="att1 >something </A2>

Dimitre Novatchev wrote:

  <xsl:stylesheet version="1.0"
          xmlns:m="B" exclude-result-prefixes="m" >

Thanks. But -
My problem is a little bit more complicate then what I described first.

The xml root out file can be different.

<xsl:template match="/">
  <xsl:if test=".//E1">
   <xsl:apply-templates select=".//E1"/>
  <xsl:if test=".//E2">
   <xsl:apply-templates select=".//E2"/>

<xsl:template match="E1">
    <xsl:element name="D1">
            copy sourc elements

<xsl:template match="E2">
    <xsl:element name="D2">
            copy sourc elements

One output should be with the namespace and the other without :
<D1   xmlns:m="B">
         <A1>something </A1>
          <A2  att="att1>something </A2>

<D2  >
         <A1>something </A1>
          <A2  att="att1>something </A2>

Where I use  xsl:copy  the xmlns will be copy - which I am not
interested in.

If I write the exclude-result-prefixes="m" as part of the xsl:stylesheet
then none of them will have the namespace.

I tried to add the namespace to the root  as attribute and fail. I have
tried  as namespace name and I didn't got
what I expected wither.

Your help will be more then welcome.


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

Current Thread