Copied to clipboard

Flag this post as spam?

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


  • Tim 174 posts 398 karma points
    Apr 20, 2010 @ 20:47
    Tim
    1

    Media sections and GetMedia issues in v4.1b2

    I'm just testing porting one of our test sites over to v4.1 to get a feel for what issues with the various XSLT files etc and I've come across one that I'm not sure is me or the code.

    The macro asks the user to select a banner image, if it's an image it will show the image, otherwise it will loop through the banners in the image and show them all. The problem is that umbraco.library:GetMedia(FolderId, 0) doesn't return anything. I've tried hard coding the value and all sorts.

    The XSLT I'm using to test atm is:

    <?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="html" omit-xml-declaration="yes"/>
     <xsl:variable name="mediaNodeId" select="/macro/imageFolder/Folder/@id" />
     <xsl:param name="currentPage"/>

     <xsl:template match="/">
      
     <pre>
      <!-- Returns the folder id (correct) -->
      <xsl:copy-of select="$mediaNodeId" />
      <!-- Returns nothing -->
      <xsl:copy-of select="umbraco.library:GetMedia($mediaNodeId, 'true')" />
     </pre>
     
     </xsl:template>
    </xsl:stylesheet>

     

    Has anyone else come across this or know what's wrong?

    Thanks

    Tim

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Apr 20, 2010 @ 21:50
    Chriztian Steinmeier
    0

    Hi Tim,

    I haven't been able to get it working either - from what I've found: It returns an error if the ID doesn't exist - otherwise, "something" (i.e, not null or false(), anyway).

    I've tried to check Codeplex for a reported bug on this but that site just doesn't work with me. I can't find anything there ...

    BTW: Using 'true' as the second argument will bite you the day you need to send false instead, because 'false' and 'true' are just strings, so both will evaluate to the C# value true - use 1/0 (one/zero) or true()/false() in XSLT for that. But of course won't change a thing for this problem ...

    /Chriztian

  • Tim 174 posts 398 karma points
    Apr 22, 2010 @ 10:38
    Tim
    0

    Thanks Chriztian,

    Agree in regards true/false as strings, it's something that's been changed and was just a lazy copy/paste ;)

    Ta

    Tim

Please Sign in or register to post replies

Write your reply to:

Draft