xsl-list
[Top] [All Lists]

RE: help on attribute name

2005-05-25 15:01:51
Wendell wrote
"
According to the XSLT Spec [7.1.3] you should be able to use an AVT.

The processor might have a bug, or perhaps (more likely) $id resolves
to something that doesn't follow the rules for legal names. Raman,
what will $id actually be?
"
Thank you all very much for trying to resolve my quandry.

Here are some more details...answering Wendell's q.

Short: id is parameter passed in a call-template.
id will be set to string literals as shown below.

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>

I am currently generating them as
<xsl:element name="ft">
<xsl:attribute name="T35">
<xsl:value-of select="$msgtype"/></xsl:attribute>
</xsl:element>
<xsl:element name="ft">
<xsl:attribute name="T11">
<xsl:value-of select="concat(@id,'X')"/>
</xsl:attribute>
</xsl:element>

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>

with a corresponding template defined as follows:

<xsl:template name="taggen">
<xsl:param name="id" />
<xsl:param name="value" />
<xsl:element name="ft">
<xsl:attribute name="{$id}"><xsl:value-of select="$value"/></xsl:attribute>
</xsl:element>
</xsl:template>

Ultimately I would generate the call-template segment
using a loop and key mechanism.

The attribute name I really want is 35 and NOT T35.
When I attempted that I got a lot
of errors and I simply stuck a T in front which I will
strip in a downstream process.

as a beginner all this hacking is being tolerated.

I hope I have provided the background.

Thanks
Raman

--~------------------------------------------------------------------
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>