Copied to clipboard

Flag this post as spam?

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


  • sewi 15 posts 35 karma points
    Sep 11, 2009 @ 12:05
    sewi
    0

    Another GetMedia Question

    Hy Guys,

    i have a Problem getting a path from the Media Library.

    <xsl:param name="currentPage"/>

    <xsl:variable name="videoid" select="$currentPage/data[@alias = 'swfFile']"/>
    <xsl:variable name="videoheight" select="$currentPage/data[@alias='VideoHeight']"/>
    <xsl:variable name="videowidth" select="$currentPage/data[@alias='VideoWidth']"/>
    <xsl:variable name="videofile" "/>

    <xsl:template match="/">


    <xsl:if test="$videoid != ''">
    <xsl:variable name="videofile" select="umbraco.library:GetMedia($currentPage/data[@alias='swfFile'], 'false')/data"/>
    </xsl:if>


    <div id="container"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</div>
    <script type="text/javascript" src="/scripts/swfobject.js"></script>
    <script type="text/javascript">
    <![CDATA[

    var path = "]]><xsl:value-of select="$videofile" /><![CDATA[";

    var videowidth = "]]><xsl:value-of select="$videowidth" /><![CDATA[";
    var videoheight = "]]><xsl:value-of select="$videoheight" /><![CDATA[";
    var s1 = new SWFObject( path,"2mountain",videowidth,videoheight,"9","#FFFFFF");
    s1.addParam("allowfullscreen","true");
    s1.addParam("allowscriptaccess","always");
    s1.addParam("wmode","transparent");
    s1.write("container");
    ]]>
    </script>
    </xsl:template>
    </xsl:stylesheet>

     

    The value of "path" is always empty.

    I think the Problem is here:

    <xsl:if test="$videoid != ''">
    <xsl:variable name="videofile" select="umbraco.library:GetMedia($currentPage/data[@alias='swfFile'], 'false')/data"/>
    </xsl:if>

    or here:

    var path = "]]><xsl:value-of select="$videofile" /><![CDATA[";

    Any Ideas?

    greetz

    Sewi

  • Chris Koiak 700 posts 2626 karma points
    Sep 11, 2009 @ 12:18
    Chris Koiak
    0

    try

    <xsl:if test="$videoid != ''">
    <xsl:variable name="videofile" select="umbraco.library:GetMedia($currentPage/data[@alias='swfFile'], 'false')/data[@alias = 'umbracoFile']"/>
    </xsl:if>
  • Thomas Höhler 1237 posts 1709 karma points MVP
    Sep 11, 2009 @ 12:26
    Thomas Höhler
    1

    I think you are missing the alias from the last data:

    <xsl:variable name="videofile" select="umbraco.library:GetMedia($currentPage/data[@alias='swfFile'], 'false')/data[@alias = 'umbracoFile']"/>

    Thomas

  • sewi 15 posts 35 karma points
    Sep 14, 2009 @ 15:10
    sewi
    0

    THX for the answers!

     

    @chris:

    doesnt help

    var path = "]]><xsl:value-of select="$videofile" /><![CDATA[";

    gives me an empty value back.

    @thomas:

    i tried this but when i save this error occurs

    System.OverflowException: Value was either too large or too small for an Int32.
    
    at System.Convert.ToInt32(Double value)
    at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
    at System.Xml.Xsl.Runtime.XmlQueryRuntime.ChangeTypeXsltArgument(XmlQueryType xmlType, Object value, Type destinationType)
    at System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList`1[] args)
    at videofile(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
    at Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
    at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer, Boolean closeWriter)
    at System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter results)
    at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, TextWriter results)
    at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)

     

    Any other ideas for my Problem?

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Sep 14, 2009 @ 15:31
    Dirk De Grave
    1

    Error occurs as the the variable is being parsed when saving the xslt. As the $currentPage variable doesn't hold a value until runtime, it will result in a GetMedia() call with a non existing number parameter.

    You could still save the xslt by ticking the 'Skip errors' checkbox.

     

    Cheers,

    /Dirk

  • sewi 15 posts 35 karma points
    Sep 14, 2009 @ 19:12
    sewi
    0

    Yeah thats it!

    You rock :-)

    thx

    Sewi

Please Sign in or register to post replies

Write your reply to:

Draft