css - Using XSLT/XML to generate styles for HTML tags? (xsl:attribute-set) -


okay, it's been tough hour or so... i'm having difficulties generating table cells different widths. i'm using xml/xslt spit out html, widths stored in xml format:

<size> <width1>5</width1> <width2>4</width2> <width3>7</width3> </size> 

using xslt's attribute-set should have table row , cells 5px, 4px, 7px widths respectively. however, trouble attribute-set needs child of <xsl:stylesheet> work. can't this: (forgive missing px)

<tr>     <td>         <xsl:attribute-set name="style">             <xsl:attribute name="width"><xsl:value-of select="size/width1"/></xsl:attribute>         </xsl:attribute-set>     </td>     <td>         <xsl:attribute-set name="style">             <xsl:attribute name="width"><xsl:value-of select="size/width2"/></xsl:attribute>         </xsl:attribute-set>     </td>     <td>         <xsl:attribute-set name="style">             <xsl:attribute name="width"><xsl:value-of select="size/width3"/></xsl:attribute>         </xsl:attribute-set>     </td> </tr> 

is there way generate html tag using xml data style them?

instead of xsl:attribute-set need add xsl:attribute inside <td> element:

<xsl:template match="size">     <tr>         <td>             <xsl:attribute name="width">                 <xsl:value-of select="./width1"/>             </xsl:attribute>         </td>          <td>             <xsl:attribute name="width">                 <xsl:value-of select="./width2"/>             </xsl:attribute>         </td>          <td>             <xsl:attribute name="width">                 <xsl:value-of select="./width3"/>             </xsl:attribute>         </td>     </tr> </xsl:template> 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -