xsl-list
[Top] [All Lists]

RE: help on attribute name

2005-05-25 17:00:12
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="{(_at_)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/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>