Copied to clipboard

Flag this post as spam?

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


  • Giorgos Grispos 145 posts 179 karma points
    Sep 17, 2010 @ 21:24
    Giorgos Grispos
    0

    Get media folder

    Hello,

    In version 4 I used to have this piece of code in order to get a media folder which has been attached to the page through a document type media picker option. ImgFolder is the name of the document type alias.

    <xsl:variable name="docFolder" select="number($currentPage/data [@alias = 'ImgFolder'])"/>

    Then I used that piece of code in my xslt to retreive all images listed under the selected folder

    <xsl:variable name="docFolder" select="number($currentPage/data [@alias = 'ImgFolder'])"/>
    <xsl:for-each select="umbraco.library:GetMedia($docFolder, 'true')/node">
    <img>
        <xsl:attribute name="src">
            <xsl:value-of select="data [@alias='image_main']"/>
        </xsl:attribute>
        <xsl:attribute name="alt">
            <xsl:value-of select="data [@alias = concat('image_title_',$dlang)]" disable-output-escaping="yes"/>
        </xsl:attribute>
    </img>
    </xsl:for-each>

    I am trying the same on version 4.5.2 with no luck. As far as I know there are changes on the xml.

    Any ideas how to get same result in new version of xml?

    Cheers,
    Giorgos

  • Giorgos Grispos 145 posts 179 karma points
    Sep 17, 2010 @ 22:08
    Giorgos Grispos
    0

    Ok maybe I was in a hurry to ask for your help,

    It wanst that different.

    <xsl:variable name="docFolder" select="number($currentPage/folderWithImages)"/>
    <xsl:for-each select="umbraco.library:GetMedia($docFolder, 'true')/*">
    <!-- place content here -->
    <xsl:value-of select="*[name() = 'umbracoFile']"/><!--get the source of teh image-->
    </xsl:for-each>

    Really simple however there is weird thing which I need to share with you. When trying to save there is an error. Probably it doesn't recognize the variable $docFolder as an Int. If I press ignore erros and save it does work properly.

    Error 
    occured
    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 (XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) at Root(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 ideas why is this happening

    Cheers,
    Giorgos

  • Giorgos Grispos 145 posts 179 karma points
    Sep 17, 2010 @ 22:57
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies