Copied to clipboard

Flag this post as spam?

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


  • Bobby 43 posts 63 karma points
    Aug 23, 2011 @ 08:03
    Bobby
    0

    Unable to get the media items from the macro media folder parameter

    Hi everyone,

    i am passing a media current as a parameter to my macro and when i try to access the media items from the folder i am unable to get the media items. i am using this macro in the RTE. here is my 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: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" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary" xmlns:autofolders.library="urn:autofolders.library"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib BlogLibrary autofolders.library ">


    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

    <xsl:template match="/">

     
    <!-- start writing XSLT -->
       <xsl:variable name="index" select="0" />
     
      <xsl:variable name="thumbWidth" select="//macro/mediaWidth" />
      <xsl:variable name="thumbHeight" select="//macro/mediaHeight" />
     <xsl:variable name="MediaId" select="//macro/mediaFolder/Folder/@id" />
     
     
      
      <xsl:if test="$MediaId">
       
       <xsl:if test="$MediaId!=''">
      <ul class="imagegallery">
       
          <xsl:for-each select="umbraco.library:GetMedia($MediaId, true())/GalleryMediaItem">
           

          <xsl:variable name="cur" select='$index+ position()' />
          
        <xsl:choose>
    <xsl:when test="$cur=1">
      <a  rel="prettyPhoto[gallery1]">
         <xsl:attribute name="href">
             <xsl:variable name="tImage" select="mediaSource" />
             <xsl:value-of select="umbraco.library:GetMedia($tImage, 'false')/umbracoFile" />
            </xsl:attribute>
           <xsl:attribute name="title">
            <xsl:value-of select="mediaDescription" />&nbsp;
             <xsl:value-of select="mediaCopyright" />
           </xsl:attribute>
           <img class="rImg">
            <xsl:attribute name="src">
              <xsl:variable name="tImage" select="mediaSource" />
              
              <xsl:value-of select="umbraco.library:GetMedia($tImage, 'false')/umbracoFile" />
            </xsl:attribute>
         <xsl:attribute name="width">
              <xsl:value-of select="$thumbWidth"/>
            </xsl:attribute>
         <xsl:attribute name="height">
              <xsl:value-of select="$thumbHeight"/>
            </xsl:attribute>
            <xsl:attribute name="alt">
              <xsl:value-of select="mediatitle"/>
            </xsl:attribute>
          </img>
     
        </a>
    </xsl:when>
    <xsl:when test="$cur &gt;1">
      <a  rel="prettyPhoto[gallery1]">
         <xsl:attribute name="href">
             <xsl:variable name="tImage" select="mediaSource" />
             <xsl:value-of select="umbraco.library:GetMedia($tImage, 'false')/umbracoFile" />
            </xsl:attribute>
         <xsl:attribute name="title">
            <xsl:value-of select="mediaDescription" />&nbsp;
             <xsl:value-of select="mediaCopyright" />
           </xsl:attribute>
          <img style="display:none">
                    <xsl:attribute name="alt">
              <xsl:value-of select="mediatitle"/>
            </xsl:attribute>
              </img>
     
        </a>
    </xsl:when>
    </xsl:choose>

          </xsl:for-each>
        </ul>
      </xsl:if>
    </xsl:if>
    <h3>
    srilaksh
    Here It is= <xsl:value-of select="$MediaId" />
    </h3>   
    <h3>
    Media id= <xsl:value-of select="$MediaId" />
    </h3>
      <h3>
    Media height = <xsl:value-of select="$thumbHeight" />
    </h3>

    <h3>
    Media width = <xsl:value-of select="$thumbWidth" />
    </h3>

    </xsl:template>

    </xsl:stylesheet>

    Can any one help me where am i going wrong.

  • 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