Return to doc.sitecore.com

Using XSLT to render Flash
Prev Next

Author: Alexander Kokoshyn
Posted: 7/12/2006 10:24:07 AM

When using Flash, Image Map, a complicated Jscript code you should resort to XSLT outputting.

Please refer to Embedding Flash in Content article for a detailed description of the problem.

Below is a workaround which allows to insert Flash only in a certain item.

XSLT code replaces the $flash1$ variable with real flash code:

<xsl:template match="*" mode="main">
    <h2><sc:text field="title"/></h2>
    <xsl:variable name="textbefore" select="substring-before(sc:fld('text',.),'$flash1$')"></xsl:variable>
    <xsl:variable name="textafter" select="substring-after(sc:fld('text',.),'$flash1$')"></xsl:variable>
    <xsl:variable name="flash1">
      <xsl:text disable-output-escaping="yes">
        <![CDATA[
          <object data="/upload/forside_flash.swf" type="application/x-shockwave-flash" width="420" height="330" id="forside_flash">
          <param name="wmode" value="transparent" />
          <param name="movie" value="/upload/forside_flash.swf" />
          </object>
        ]]>  
      </xsl:text>
    </xsl:variable>
    <xsl:value-of select="concat($textbefore,$flash1,$textafter)" disable-output-escaping="yes"></xsl:value-of><br/>
</xsl:template>

Prev Next