Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing tag properties based on XML data

Status
Not open for further replies.

JRobins1

Programmer
May 22, 2003
1
CA
I am trying to change the alignment of a <td> tag based on XML data:
<page>
<item>
<text>Hello World</text>
<align>right</align>
<item>
</page>

but I dont know how to do it. Is there a way to do this using CSS or scripting??
 
Use <xsl:attribute>

For example:
Code:
<xsl:template match=&quot;text&quot;>
  <td>
  <xsl:attribute name=&quot;align&quot;>
    <xsl:value-of select=&quot;../align&quot;/>
  </xsl:attribute>
  <xsl:value-of select=&quot;.&quot;/>
  </td>
</xsl:template>

or:
Code:
<xsl:template match=&quot;item&quot;>
  <td>
  <xsl:attribute name=&quot;align&quot;>
    <xsl:value-of select=&quot;align&quot;/>
  </xsl:attribute>
  <xsl:value-of select=&quot;text&quot;/>
  </td>B
</xsl:template>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top