RE: [xsl] help on attribute name

Subject: RE: [xsl] help on attribute name
From: "Aron Bock" <aronbock@xxxxxxxxxxx>
Date: Thu, 26 May 2005 00:00:12 +0000
Raman, your approach should work. For example, this XML:

<data>
   <eftee id="T21" val="T-ventuno"/>
   <eftee id="T67" val="T-sessantasette"/>
   <eftee id="T1" val="T-uno"/>
</data>

Transformed with this XSL (xalan):

<?xml version="1.0" encoding="iso8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="xml" indent="yes"/>


   <xsl:template match="/">
       <data>
           <xsl:apply-templates/>
       </data>
   </xsl:template>

<xsl:template match="eftee">
<ft>
<xsl:attribute name="{@id}"><xsl:value-of select="@val"/></xsl:attribute>
</ft>
</xsl:template>
</xsl:stylesheet>



Produces:


<?xml version="1.0" encoding="UTF-8"?>
<data>
   <ft T21="T-ventuno"/>
   <ft T67="T-sessantasette"/>
   <ft T1="T-uno"/>
</data>


Check the quotes: for example, in the snippet below select='D' should have been select="'D'", et cetera. As you know select="D" (select the child D) is not the same as select="'D'" (select the literal character D)


Regards,

--A


this is what I wish to generate <?xml version="1.0" encoding="UTF-8"?> <fmcpfixxml fixversion="4.2"> <ft T35="D"/> <ft T11="6462"/> <ft T1="75265"/> <!-- lot more tuples like the above --> </fmcpfixxml>


<snip/>



This ugly and code bloat. I would like to have generated this as follows

<xsl:call-template name="taggen" >
<xsl:with-param name="id" select='T35' />
<xsl:with-param name="value" select='D' />
</xsl:call-template>


_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


Current Thread