Search code examples
htmlxsltxslt-1.0xslt-2.0

xslt add title to column name


Hey i have a problem.

 <xsl:variable name="x" select="'MY_TITLE'"/>

I need to add title to column in table but title which i want to add is variable (x) and i dont know how to deal with it.

 <table border="1">
      <xsl:variable name="items" select="$xsd//xs:complexType[@name = 'ONDType']/node()/attribute::*[1]"/>
      <tr bgcolor="#9acd32">
        <xsl:for-each select="$items">
          <td title='$x'>
            <xsl:value-of select="."/>
          </td>
        </xsl:for-each>
      </tr>

If i run this code i get title $x but i want to get MY_TITLE


Solution

  • Try:

    <td title="{$x}">
    

    To understand how it works, read up on attribute value templates.