Complex XSLT Macro for embedding an I frame - using Paramaters

 (http://forum.umbraco.org/yaf_postst4641_cant-embed-html-in-page.aspx)

Create a new macro and in it create 3 parameters "location", "width" and "height".
Check the "Use in editor" checkbox. Now create a xslt that looks something like this:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
<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="location" select="/macro/location"/>
<xsl:variable name="width" select="/macro/width"/>
<xsl:variable name="height" select="/macro/height"/>

<xsl:template match="/">
<iframe src="{$location}" width="{$width}" height="{$height}"></iframe>
</xsl:template>

</xsl:stylesheet>

Comments

Popular posts from this blog

Umbraco - Reset the Admin Password via SQL Server

Create a .NET Contact Form that Gets the Last Url Visited in C# Can also be Used in Umbraco

Umbraco Macro for IFrame when Embedding Video, Vimeo Universal Player, or other types of IFrame on to a Page XSLT version and Razor Version