This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Namespace question
- To: xsl-list at lists dot mulberrytech dot com
- Subject: [xsl] Namespace question
- From: Ayelet Kotzer <akotzer at savvion dot com>
- Date: Wed, 03 Jan 2001 16:21:59 -0800
- Organization: Savvion
- Reply-To: xsl-list at lists dot mulberrytech dot com
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:xsl="http://www.w3.org/1999/XSL/Transform"
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>
<xsl:if test=".//E2">
<xsl:apply-templates select=".//E2"/>
</xsl:if>
</xsl:template>
<xsl:template match="E1">
<xsl:element name="D1">
copy sourc elements
</xsl:element>
</xsl:template>
<xsl:template match="E2">
<xsl:element name="D2">
copy sourc elements
</xsl:element>
</xsl:template>
One output should be with the namespace and the other without :
<D1 xmlns:m="B">
<A1>something </A1>
<A2 att="att1>something </A2>
</D1>
<D2 >
<A1>something </A1>
<A2 att="att1>something </A2>
</D2>
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.
Thanks,
Ayelet
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list