Subject: Re: Good old namespace problem(slightly different)!!
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 30 Apr 2003 17:32:18 +0100
|
<xsl:text disable-output-escaping="yes">
<![CDATA[
<myheader xsi:schemaLocation="www.abc.org/schema/mainschema.xsd"
using d-o-e is almost always the wrong thing to do.
the namespace name is part of the name of the element so
you don't want to
<xsl:copy-of select="$imported-xml"/>
You want to do as you would have done with any other name change: apply
templates to these nodes that make the change,
<xsl:apply-templates select="$imported-xml/*" mode="x"/>
(you don't need a variable you could just as well go
<xsl:copy-of select="document('imported.xml')/*" mode="x"/>
then something like
<xsl:template mode="x" match="*">
<xsl:element namespace="www.abc.org" name="local-name()">
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="x"/>
</xsl:element>
</xsl:template>
the "x" mode just renames any element it finds into the "www.abc.org"
namespace.
Alternatively of course you could add xmlns="www.abc.org" to the top
level element of your imported.xml so the elements were in the right
namespace to start with, then your original stylesheet would work.
David
________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
- Re: Transform XML, (continued)
- Mike Haarman - Wed, 30 Apr 2003 12:05:36 -0400 (EDT)
- XSL Chatr - Wed, 30 Apr 2003 12:08:17 -0400 (EDT)
- David Carlisle - Wed, 30 Apr 2003 15:46:45 -0400 (EDT) <=
- Michael Kay - Wed, 30 Apr 2003 16:07:40 -0400 (EDT)
- Bryan Archer - Wed, 30 Apr 2003 11:57:32 -0400 (EDT)
- cknell - Wed, 30 Apr 2003 15:29:06 -0400 (EDT)
- me - Wed, 30 Apr 2003 15:46:10 -0400 (EDT)
|
|