[xslt] namespace URI for child elements
- From: Gerhard Dieringer <Gerhard Dieringer nexgo de>
- To: xslt gnome org
- Subject: [xslt] namespace URI for child elements
- Date: 10 Nov 2002 17:11:45 +0100
Hi
I have the following question:
the following stylesheet:
--------------------------------------------------------
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:in="input"
xmlns:out="output"
version='1.0'>
<xsl:output method="xml" indent="yes" doctype-system="output.dtd"/>
<xsl:template match="in:top">
<xsl:element name="out:toplevel">
<xsl:apply-templates select="in:sub1"/>
<xsl:apply-templates select="in:sub2"/>
</xsl:element>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="in:sub1">
<xsl:text>
</xsl:text>
<xsl:element name="out:sublevel1">
<xsl:value-of select="concat('data=',@data)"/>
</xsl:element>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="in:sub2">
<xsl:element name="out:sublevel2">
<xsl:value-of select="concat('data=',@data)"/>
</xsl:element>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
--------------------------------------------------------
gives with the following input file:
--------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<in:top xmlns:in="input">
<in:sub1 data="hello"/>
<in:sub2 data="world"/>
</in:top>
--------------------------------------------------------
the output:
--------------------------------------------------------
<?xml version="1.0"?>
<!DOCTYPE toplevel SYSTEM "output.dtd">
<out:toplevel xmlns:out="output">
<out:sublevel1 xmlns:out="output">data=hello</out:sublevel1>
<out:sublevel2 xmlns:out="output">data=world</out:sublevel2>
</out:toplevel>
--------------------------------------------------------
Is there a way to avoid the (not needed) namespace-URIs in
<out:sublevel1> and <out:sublevel2>
and get the result
--------------------------------------------------------
<?xml version="1.0"?>
<!DOCTYPE toplevel SYSTEM "output.dtd">
<out:toplevel xmlns:out="output">
<out:sublevel1>data=hello</out:sublevel1>
<out:sublevel2>data=world</out:sublevel2>
</out:toplevel>
--------------------------------------------------------
-------
Gerhard
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]