|
Subject: [xsl] <xsl:copy> and namespaces From: "Joeri Belis" <joeri.belis@xxxxxxxxxxxx> Date: Mon, 15 Apr 2002 16:08:36 +0200 |
Can anyone explain the use of namespaces and <xsl:copy>. When my XML file
has no namespaces defined, the stylesheet works perfect. But with the
namespaces added ( like in my example ), the copy failes. How should i copy
when namespaces
are involved. So i have a default namespace ( urn:my-ns ) and a alias for
'o' ( urn:my-o-ns ). The record and all the childeren of record take the
default ns. Why is this interfering in my copy. I have specified the default
namespace aswell in my stylesheet.
Thanks for any feedback
Joeri
XML file
<?xml version="1.0"?>
<record xmlns="urn:my-ns" xmlns:o="urn:my-o-ns">
<field>
test
</field>
</record>
StyleSheet
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="urn:my-ns"
xmlns:o="urn:my-o-ns">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates select="record"/>
</xsl:template>
<xsl:template match="record">
<xsl:copy>
<xsl:apply-templates select="field"/>
</xsl:copy>
</xsl:template>
<xsl:template match="field">
<xsl:copy/>
</xsl:template>
</xsl:stylesheet>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Re:, Jeni Tennison | Thread | Re: [xsl] <xsl:copy> and namespaces, Jeni Tennison |
| [no subject], Biray Giray | Date | [xsl] Re:, Jeni Tennison |
| Month |