[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Insert an attribute to all nodes.


Subject: Insert an attribute to all nodes.
From: Rainer.Jung@xxxxxxxxxxxx
Date: Wed, 11 Oct 2000 17:59:26 +0200

Hi !

I'm trying to add to every node an attribute.
It's no good idea, but we need it, to be valid to an old dtd.
I tried the following:

<xsl:stylesheet version="1.0"
                xslns:xsl="http://www.w3.org/1999/XSL/Transform">

 <xsl:param name="version">
  <xsl:value-of select="/PACKAGE/DOCUMENT/@VERSION" />
 </xsl:param>

 <xsl:template select="*">
  <test>
  <xsl:element name="self:name">
  <xsl:attribute name="VERSION"><xsl:value-of select="$version"
/></xsl:attribute>
   <xsl:for-each select="@*">
    <xsl:attribute name="self:name"><xsl:value-of select="."
/></xsl:attribute>
   </xsl:for-each>
   <xsl:apply-templates />
  </xsl:element>
  </test>
 </xsl:template>
</xsl:stylesheet>

I just inserted <test/> to find, what could be wrong.
I alway get the output:

<?xml version="1.0" encoding="UTF-8"?>
<test/>

That's all.
Shouldn't there be all nodes like the original with 
<test>s between!?

Some ideas?

Grüße,
	Rainer
-- 
*ProSieben Digital Media
Rainer Jung - Technik/Webmaster
Medienallee 7 - 85774 Unterföhring
Telefon: ++49 (89) 9507-8428


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread