As with the rest, it’s the little things that really get to you. If, like me,  you were struggling to get the correct syntax for javascript inside an XSL, here’s a little snippet that will work for you. It discloses the value of the current SitePublisher page to your javascript layer

<script type="text/javascript">
    <xsl:text disable-output-escaping="yes"><![CDATA[//<![CDATA[]]></xsl:text>
                   var iw_ls_page_name="<xsl:value-of select="/Properties/Data/External/Parameters/Datum[@Name='iw-ls-page-name']" />";
                   alert(iw_ls_page_name);
    <xsl:text disable-output-escaping="yes"><![CDATA[//]]]]></xsl:text>
    <xsl:text disable-output-escaping="yes">></xsl:text>
</script>

It may be that your javascript is in a js file. In that case, use the following sample syntax:

<script type="text/javascript"><xsl:attribute name="src">someScript.js</xsl:attribute><xsl:text disable-output-escaping="yes"><![CDATA[ ]]></xsl:text></script>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s