Copied to clipboard

Flag this post as spam?

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


  • Johan Plesner Hamann 105 posts 199 karma points
    Dec 03, 2010 @ 23:56
    Johan Plesner Hamann
    0

    how to pass parameters as an int? or something like that "Flickr API Search"

    I would like to make a macro with parameter where you can set volume of images in the Flickr API Search.

     <xsl:variable name="taggedPhotos" select="ProWorks.FlickrXSLTSearch:ByTag('tag', '', '', '', {$source}, '', '', '')"/>

    Error occured

    System.Xml.Xsl.XslLoadException: Unexpected token '{' in the expression.
    ...:ByTag('tag', '', '', '', -->{<-- $source}, '', '', '') An error occurred at D:\hshome\jphamann\zinoflick.zargo.dk\xslt\634270169192196678_temp.xslt(17,3).
    at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)
    at System.Xml.Xsl.XslCompiledTransform.Load(XmlReader stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)
    at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)

    I do not know what to write to get it to work.

    Cheers
    Johan

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Dec 04, 2010 @ 01:09
    Chriztian Steinmeier
    0

    Hi Johan,

    Get rid of the curly braces around $source and you should be good to go (assuming everything else is OK).

    /Chriztian

  • Johan Plesner Hamann 105 posts 199 karma points
    Dec 04, 2010 @ 01:13
    Johan Plesner Hamann
    0

    no good

    Hide ErrorsError occured

    System.OverflowException: Value was either too large or too small for an Int32.
    at System.Convert.ToInt32(Double value)
    at System.Double.System.IConvertible.ToInt32(IFormatProvider provider)
    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 (XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
    at Root(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, XmlSequenceWriter results)
    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.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, TextWriter 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)

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Dec 04, 2010 @ 01:24
    Chriztian Steinmeier
    0

    OK - this happens when you save the XSLT, so how are you selecting the source variable? If it's based on $currentPage, you'll need to make sure it only tries to call the function when there's an actual value in $source - try checking the "Ignore errors" before saving - it should save OK, and if it works in frontend (on the page you want this to show) you can wrap an xsl:if around the call to make it save without errors, e.g.:

    <xsl:template match="/">
        <xsl:if test="$currentPage/@id &gt; 0">
            <xsl:variable name="source" select="$currentPage/propertyName" />
            <xsl:variable name="taggedPhotos" select="ProWorks.FlickrXSLTSearch:ByTag('tag', '', '', '', $source, '', '', '')" />
    
            <!-- etc. -->
    
        </xsl:if>
    </xsl:template>

    /Chriztian 

  • Johan Plesner Hamann 105 posts 199 karma points
    Dec 04, 2010 @ 01:38
    Johan Plesner Hamann
    0

    Thanks Chriztian
    I always forget that it is running the code.new to this and xslt can be tricky. I try it as the first thing tomorrow.

  • Johan Plesner Hamann 105 posts 199 karma points
    Dec 04, 2010 @ 11:24
    Johan Plesner Hamann
    0

    Good damn it. it worked. and again to make a newbie error forget to always test the front end. super many thanks for your help Mr knowledge man.

    By the way it does not work for me the

     <xsl:if test="$currentPage/@id &gt; 0">

    but I'm good with it right now.

    Cheers,
    Johan

  • Johan Plesner Hamann 105 posts 199 karma points
    Dec 05, 2010 @ 01:34
    Johan Plesner Hamann
    0

    ok ok ok I have it
    I only got one picture out at a time, but only tag one picturer ... I can see that it was a minor detail.
    So I spent some time finding a solution. our.umbraco.org/...-how-to-convert-umbracolibraryRenderTemplate-parameter-to-int32


    And the solution is!

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

    <
    xsl:if test="$volume != ''">
    <xsl:variable name="taggedPhotos" select="ProWorks.FlickrXSLTSearch:ByTag('zinoflick', '', 'b', 't', $volume, 'date-posted-desc', '', '')"/>

    Great times

     

     

     

     

Please Sign in or register to post replies

Write your reply to:

Draft