|
Subject: Re: [xsl] 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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Good old namespace problem(sl, XSL Chatr | Thread | RE: [xsl] Good old namespace proble, Michael Kay |
| Re: [xsl] Transform XML, Karl J. Stubsjoen | Date | Re: [xsl] Transform XML, me |
| Month |