xslt attributes

Here should go questions about transforming XML with XSLT and FOP.
Posts: 1

xslt attributes

Mon Oct 03, 2005 6:34 pm

Hi, I have an xml file. I am trying to get the data from this by using the xslt.
my xml is as follows,
<xsl:template match="tlkpSpec">
<!-- <code><xsl:apply-templates select="LOC"/></code> -->
<!-- <name><xsl:apply-templates select="NAME"/></name> -->
<Lookup value="should put code value here"> <xsl:apply-templates select="SPECIAL"/></Lookup>


The problem is is that i need to take the value of code and place it into my lookup value?. Is there a way of doing this. Alternativley, i need to create an incrementing number for each value. Please can someone help?.

Posts: 6001

Tue Oct 04, 2005 8:21 am


In order to achieve your goal the Lookup element should be inserted like this in your xsl file:

Code: Select all

        <xsl:element name="LookupCombo">
            <xsl:attribute name="value">
                <xsl:value-of select="//code/text()"/>

Of course the value of the select expression should point to the correct text value of the code element.

You can find more information about the use of xsl:element here:

Best regards, Radu.
Site Admin
Posts: 2100

Tue Oct 04, 2005 12:29 pm


You can also use an atribute value template and specify something like

<Lookup value="{code}"> <xsl:apply-templates select="SPECIAL"/></Lookup>

Best Regards,

Return to “XSLT and FOP”

Who is online

Users browsing this forum: No registered users and 0 guests