Umbraco/Samples and Articles/XSLT/Embed FlashPlayer

This XSLT will allow you to embed a FlashPlayer instance in a page and load the content specified by 3 parameters in a macro - flashFile, width and height. To test this XSLT create a new macro with three parameters 1. FlashFile - media content type 2. width - number 3. height - number

Now you can insert this macro in a template or content page and the specified flash file will embed correctly.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet 
	version="1.0" 
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
	xmlns:msxml="urn:schemas-microsoft-com:xslt"
	xmlns:umbraco.library="urn:umbraco.library"
	exclude-result-prefixes="msxml umbraco.library">


<xsl:output method="xml" omit-xml-declaration="yes"/>

<xsl:param name="currentPage"/>

<xsl:variable name="flashFile" select="/macro/flashFile" /> 

<xsl:template match="/">

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="flashControl" align="middle">
<xsl:attribute name="width">
  <xsl:value-of select="/macro/width" />
</xsl:attribute>
<xsl:attribute name="height">
  <xsl:value-of select="/macro/height" />
</xsl:attribute>
<param name="movie"> 
<xsl:attribute name="value">
  <xsl:value-of select="$flashFile/node/data [@alias='umbracoFile']" /> 
</xsl:attribute>
</param>
<param name="quality" value="high" /> 
<param name="bgcolor" value="#ffffff" /> 
<embed quality="high" bgcolor="#ffffff" name="flashControl" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> 
  <xsl:attribute name="width">
    <xsl:value-of select="/macro/width" />
  </xsl:attribute>
  <xsl:attribute name="height">
    <xsl:value-of select="/macro/height" />
  </xsl:attribute>
  <xsl:attribute name="src">
    <xsl:value-of select="$flashFile/node/data [@alias='umbracoFile']" /> 
  </xsl:attribute>
</embed>
</object>


</xsl:template>

</xsl:stylesheet>