>...I write a transformation where in I mention this namespace as the
>value for "exclude-result-prefixes" attribute in the top level element.
>Still in the result tree I see elements under this namespace.
>I understand this is the wrong behavior. Is the problem because I am
>using <xsl:copy-of select="*"/> in the transformation?
--------------------------------------------------------------------------
>Probably. Namespace declarations will only be excluded if they are not
>used. If you want the element to be changed from "foo:a" to "a", you
>cannot use copy-of because you intend to change the element name. Can
>you state that you want all the names to change like that? If that is
>your plan, you can use xsl:element to create a new element and assign
>it a name and namespace (or no namespace).

>It appears that you need to clarify the goal of the whole stylesheet,
>then choose the proper instructions to make that transformation occur.
>Any questions in this area would be about generic XSLT and could be
>answered better by the XSL FAQ or a good book on XSLT.
>.................David Marston


Hi David,
Thanks for the response,
I will try to explain my case ,
I have an XML which looks something like this,

<a:A>
  <b:B>
     <C1/><C2/><C3/><C4/><C5/><C6/><C7/><C8/><C9/>
  </b:B>
</a:A>

I want something like this,
<b:B>
 <C1/><C2/><C3/><C4/><C5/><C6/><C7/><C8/><C9/>
</b:B>

I thought I will simply use <exclude-result-prefixes = "a"> and I will get
the desired.But that does not work.
If I use copy of , then I get something like this,

<b:B>
 <b:C1 a/><b:C2 a/><b:C3 a/><b:C4 a/><b:C5 a/><b:C6 a/><b:C7 a/><b:C8
a/><b:C9 a/>
</b:B>

That is to say it adds all the namespace nodes abobe the particular node
that gets copied. This unnecessarily makes my document bulky. Because I am
not sure how many nodes under <b:B> would be present in the incoming doc and
what there names would be, therefore I cannot even use <xsl:element> to
create elements.

Is there any way whereby I can avoid this recurrence of namespace nodes in
the resultant document?

Regards,
Ankur Saiagl



Reply via email to