DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Xsl Variable With Firefox Workaround

  • submit to reddit
        xsl variable with firefox workaround. This instance takes a previously defined width as ($Width) 255px and applies it to a div.

<xsl:variable name="x">;width:<xsl:value-of select="($Width) - 10"/>px</xsl:variable>
<!-- same variable for Firefox -->
<xsl:variable name="y">width:<xsl:value-of select="($Width) - 15"/>px!important</xsl:variable>

<div id="z>
 <xsl:attribute name="style">
  <xsl:value-of select="$y" />
  <xsl:value-of select="$x" />

The resulting HTML will look like this:

<div id="z" style="width:240px!important;width:245px">