Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Hayley 23 posts 71 karma points
    Dec 29, 2009 @ 11:48
    Hayley
    0

    Not all macro parameters being passed into XSLT from Template

    Hi,

    I'm having a problem with one of my macros. It's working correctly in the editor, but when I try to use it in a template the width and height parameters are not passed into the XSLT, the FileId is though. The XSLT is a modification of the Insert Flash package, I've included the XSLT and the macro tag below. 

    Is there something I've done wrong in the tag? As the XSLT works perfectly when used from the editor.

    TAG

     

    <umbraco:Macro Alias="InsertFlash" runat="server" Width="213" Height="142" FileId="[#MediaFile]" CssId="tempCssId" />

     

    XSLT

    <?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:msxsl="urn:schemas-microsoft-com:xslt" xmlns:randomTools="http://www.umbraco.org/randomTools" xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" exclude-result-prefixes="msxml msxsl randomTools umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets "> <xsl:output method="xml" omit-xml-declaration="yes"/> <xsl:param name="currentPage"/> <xsl:template match="/"> <xsl:variable name="fileId" select="/macro/FileId/node"/> <xsl:variable name="fileURL" select="/macro/FileURL"/> <xsl:variable name="width" select="/macro/Width"/> <xsl:variable name="height" select="/macro/Height"/> <xsl:variable name="cssId" select="/macro/CssId"/> <xsl:if test="$fileId != '' or $fileURL != ''"> <xsl:variable name="finalFileURL"> <xsl:choose> <xsl:when test="$fileId != ''"> <xsl:value-of select="$fileId/data[@alias = 'umbracoFile']"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$fileURL"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="finalCssId"> <xsl:choose> <xsl:when test="string($cssId) != ''"><xsl:value-of select="$cssId"/></xsl:when> <xsl:otherwise><xsl:value-of select="randomTools:GetRandom()"/></xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:if test="string($cssId) = ''"> <div> <xsl:attribute name="id"><xsl:value-of select="$finalCssId"/></xsl:attribute> &nbsp; </div> </xsl:if> <object classid="clsid:d27cdb6e-4c3f-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" align="middle"> <xsl:attribute name="id"> <xsl:value-of select="$finalCssId" /> </xsl:attribute> <xsl:attribute name="width"> <xsl:value-of select="$width" /> </xsl:attribute> <xsl:attribute name="height"> <xsl:value-of select="$height" /> </xsl:attribute> <param name="movie"> <xsl:attribute name="value"> <xsl:value-of select="$finalFileURL"/> </xsl:attribute> </param> <param name="allowScriptAccess" value="sameDomain" /> <param name="menu" value="false" /> <param name="quality" value="high" /> <param name="bgcolor" value="#ffffff" /> <embed quality="high" bgcolor="#ffffff" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> <xsl:attribute name="width"> <xsl:value-of select="$width" /> </xsl:attribute> <xsl:attribute name="height"> <xsl:value-of select="$height" /> </xsl:attribute> <xsl:attribute name="src"> <xsl:value-of select="$finalFileURL"/> </xsl:attribute> </embed> </object> <script language="JavaScript" type="text/javascript" src="/scripts/NoIEActivate.js"> <xsl:text disable-output-escaping="yes"> // blank line to ensure end of script tag is used </xsl:text> </script> </xsl:if> </xsl:template> <msxsl:script language="c#" implements-prefix="randomTools"> <msxsl:assembly href="../bin/umbraco.dll"/> <![CDATA[ //Basic idea from http://our.umbraco.org/wiki/reference/xslt/snippets/getting-a-series-of-unique-random-numbers /// <summary> /// Gets a random integer that falls between the specified limits /// </summary> /// <returns>A random integer within the specified range</returns> public static int GetRandom() { Random r = umbraco.library.GetRandom(); int returnedNumber = 0; lock (r) { returnedNumber = r.Next(); } return returnedNumber; } ]]> </msxsl:script> </xsl:stylesheet>

     

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Dec 29, 2009 @ 12:24
    Thomas Höhler
    1

    Try to give them other names like X and Y. And Check the spelling (case sensitive). There had been issues with properties that have names from the standard properties of user controls.

    just a guess, Thomas

  • Hayley 23 posts 71 karma points
    Dec 29, 2009 @ 12:32
    Hayley
    0

    Hi Thomas,

    Thanks for the hint, that fixed it.

    Hayley

Please Sign in or register to post replies

Write your reply to:

Draft