Setting values in XSL documents

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Setting values in XSL documents

Post by anjanesh »

Im trying out XSL.

Code: Select all

<xsl:element name="a">
 <xsl:attribute name="style">
  // What do to for color:blue;text-decoration:none
 </xsl:attribute>
</xsl:element>
How do I change style properties - say color:blue;text-decoration:none ?

Thanks
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Code: Select all

<a>
<xsl:attribute-set>
  <xsl:attribute name="font-weight">bold</xsl-attribute>
  <xsl:attribute name="style">color:blue;text-decoration:none</xsl:attribute>
</xsl:attribute-set>
</a>
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Thanks. So this is how it works.
Is there a method to include Javascript methods for tags ?

Using href :

Code: Select all

<xsl:attribute name="href">
     <xsl:value-of select="$ClickUrl" />
    </xsl:attribute>
I tried to replace this with onclick (will javascript attributes / methods get parsed by xls ? )

Code: Select all

<xsl:attribute name="onclick">
      // What to do to insert window.open('$ClickUrl')
     </xsl:attribute>
Thanks
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

I can only advise to test it yourself.. ;)

If you want "special" entities in your value, you will have to use htmlentities are CDATA to escape it.

Code: Select all

<xsl:attribute name="bar">htmlentities("<foo/>")</xsl:attribute>
<xsl:attribute name="bar"><![CDATA[ <foo/> ]]></xsl:attribute>
Post Reply