Copied to clipboard

Flag this post as spam?

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


  • Heather Floyd 610 posts 1032 karma points MVP 6x c-trib
    Jul 21, 2009 @ 06:09
    Heather Floyd
    0

    Iterate Media Folders?

    Hello,

    I have some subfolders in Media, and would like to display thumbnails for them regardless of which folder they are in. This is what I cooked up, but it isn't returning results as I desire. Generally I am getting "Error parsing XSLT file: \xslt\Page_RelatedMediaThumbs.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:Designit.VideoEmbed="urn:Designit.VideoEmbed"
        exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets Designit.VideoEmbed ">

    <!--Page_RelatedMediaThumbs.xslt-->

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

    <!--MACRO PARAMS:
        PageNode    The Page for which the links data should be returned (you can leave blank if using currentpage)    contenttree
        DataToReturn    What is the RelatedMedia Property?    propertyTypePicker
        UseCurrentPage    Use the current page rather than a specified page    bool
        ImageWidth    Width of Thumbnails (pixels)    (you only need to specify width OR height)    number
        ImageHeight    Height of Thumbnails (pixels) (you only need to specify width OR height)    number
        ShowCaption    Display the caption?    bool
        NumToShow    How many images should be displayed (leave blank for all)    number
    -->

    <xsl:param name="currentPage"/>
    <xsl:variable name="DataToReturn" select="macro/DataToReturn" />
    <xsl:variable name="propertyAlias" select="$DataToReturn"/>
    <xsl:variable name="PageNode" select="/macro/PageNode"/>
    <xsl:variable name="PageNodeSource" select="/macro/PageNode/node"/>
    <xsl:variable name="UseCurrentPage" select="/macro/UseCurrentPage"/>
    <xsl:variable name="ShowCaption" select="/macro/ShowCaption"/>
    <xsl:variable name="mImageWidth" select="/macro/ImageWidth"/>
    <xsl:variable name="mImageHeight" select="/macro/ImageHeight"/>

    <xsl:variable name="NumToShow">
        <xsl:if test="string(/macro/NumToShow) !=''">
            <xsl:value-of select="/macro/NumToShow"/>
        </xsl:if>
        <xsl:if test="string(/macro/NumToShow) =''">
            <xsl:value-of select="99999"/>
        </xsl:if>
    </xsl:variable>

    <xsl:variable name="ImageWidth">
        <xsl:if test="string($mImageWidth) !=''">
            <xsl:value-of select="$mImageWidth"/>
        </xsl:if>
        <xsl:if test="string($mImageWidth) =''">
            <xsl:value-of select="0"/>
        </xsl:if>
    </xsl:variable>

    <xsl:variable name="ImageHeight">
        <xsl:if test="string($mImageHeight)!=''">
            <xsl:value-of select="$mImageHeight"/>
        </xsl:if>
        <xsl:if test="string($mImageHeight)=''">
            <xsl:value-of select="0"/>
        </xsl:if>
    </xsl:variable>
    <xsl:variable name="ImageDimensions">
            <xsl:if test="number($ImageWidth) &gt; 0 and number($ImageHeight) &gt; 0">
                <xsl:value-of select="concat('&amp;Width=',$ImageWidth,'&amp;Height=',$ImageHeight,'&amp;Constrain=true')" />
            </xsl:if>
            <xsl:if test="number($ImageWidth) &gt; 0 and number($ImageHeight) &lt;= 0">
                <xsl:value-of select="concat('&amp;Width=',$ImageWidth)" />
            </xsl:if>
            <xsl:if test="number($ImageWidth) &lt;= 0 and number($ImageHeight) &gt; 0">
                <xsl:value-of select="concat('&amp;Height=',$ImageHeight)" />
            </xsl:if>
        </xsl:variable>



    <!--TEMPLATE: MAIN -->
    <xsl:template match="/">

    <xsl:variable name="AllMediaItems">
        <xsl:if test = "string($PageNodeSource) != ''">
            <xsl:value-of select="$PageNodeSource/data[@alias=$DataToReturn]"/>
        </xsl:if>
        <xsl:if test = "string($PageNodeSource) = ''">
            <xsl:value-of select="$currentPage/data[@alias=$DataToReturn]"/>
        </xsl:if>
    </xsl:variable>

    <xsl:variable name="MediaSplit" select="umbraco.library:Split($AllMediaItems, ',')" />
    <xsl:variable name="CountNodes" select="count($MediaSplit)"/>
    {MediaSplit=<xsl:value-of select="$MediaSplit"/>}
    <xsl:for-each select="$MediaSplit/value">
    <!--{XML:<xsl:copy-of select="."/>}-->
    <!--<xsl:if test="position() &lt;= $NumToShow">-->
        <xsl:variable name="MediaSplitItemID" select="." />
        <xsl:if test="$MediaSplitItemID!=''">
        <!--{MediaSplitItemID=<xsl:value-of select="$MediaSplitItemID"/>::IterateMedia}-->
            <xsl:call-template name="IterateMedia"> 
                <xsl:with-param name="MediaIterateItem" select="$MediaSplitItemID"/> 
                <xsl:with-param name="ItemNumber" select="position()"/>
            </xsl:call-template>
        </xsl:if>
    <!--</xsl:if>-->
    </xsl:for-each>
    </xsl:template>

    <!--TEMPLATE: Iterate Media-->
    <xsl:template name="IterateMedia">
    <xsl:param name="MediaIterateItem"/> <!--Expects NodeID -->
    <xsl:param name="ItemNumber"/>
        <xsl:variable name="MediaNode" select="umbraco.library:GetMedia($MediaIterateItem, 'false')" />
        <xsl:variable name="MediaType" select="$MediaNode/@nodeTypeAlias" />
        <!--{MediaType=<xsl:value-of select="$MediaType"/>}    -->
        <xsl:if test="$MediaType !='Folder'">
            <xsl:call-template name="FormatMedia"> 
                <xsl:with-param name="MediaItemID" select="$MediaNode/@id"/> 
                <xsl:with-param name="ItemNumber" select="$ItemNumber"/>
            </xsl:call-template>
        </xsl:if>
        <xsl:if test="$MediaType ='Folder'">
            <xsl:variable name="FolderID" select="$MediaNode/@id"/>
            <!--{FolderID=<xsl:value-of select="$FolderID"/>}    -->
            <xsl:if test="$FolderID !=''">
            <xsl:for-each select="umbraco.library:GetMedia($FolderID, 'false')/node">
                <xsl:variable name="ItemID" select="@id"/>
                {ItemID=<xsl:value-of select="$ItemID"/>}
                <xsl:if test="$ItemID!=''">
                <xsl:call-template name="IterateMedia"> 
                    <xsl:with-param name="MediaIterateItem" select="."/> 
                    <xsl:with-param name="ItemNumber" select="$ItemNumber"/>
                </xsl:call-template>
                </xsl:if>
            </xsl:for-each>
            </xsl:if>
        </xsl:if>

    </xsl:template>

    <!--TEMPLATE: Format Media Item-->
    <xsl:template name="FormatMedia">
    <xsl:param name="MediaItemID"/> <!--Expects NodeID -->
    <xsl:param name="ItemNumber"/>
        <xsl:variable name="MediaNode" select="umbraco.library:GetMedia($MediaItemID, 'false')" />
        <xsl:variable name="MediaItemURL" select="$MediaNode/data [@alias = 'umbracoFile']" />
        <xsl:variable name="FullImageURL"  select="concat('/umbraco/ImageGen.ashx?image=',$MediaItemURL, $ImageDimensions)" />
           
            <div class="RelatedMediaItem">
                <a href="{$MediaItemURL}">
                    <div class="RelatedMediaThumb">
                        <img class="RelatedMediaImg">
                              <xsl:attribute name="src">
                                    <xsl:value-of select="$FullImageURL"/>
                              </xsl:attribute>
                        </img>
                    </div>
                    <xsl:if test="$ShowCaption='1'">
                        <div class="RelatedMediaCaption">
                            <xsl:value-of select="$MediaNode/data [@alias = 'mediaImageCaption']"/>
                        </div>
                    </xsl:if>
                </a>
            </div>

    </xsl:template>

    </xsl:stylesheet>

    Any ideas about where I am going wrong?

    Thanks!

    Heather

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Jul 21, 2009 @ 10:39
    Douglas Robar
    0

    Hi, Heather,

    To be honest, I didn't digest your xslt looking for  errors. Before that I wanted to ask if the xslt error is when you save the macro or when you run it?

    If on save... click the 'skip testing' box. Does the macro run properly? GetMedia() is notorious for blowing up on the initial xslt save but generally runs fine.

    If when running... what are the next couple lines of the error? Usually there will be a clue about line number, syntax expected, or something like that to help narrow down where it blew up. Don't forget that you might get more output if you use the ?umbDebugShowTrace=true querystring.

    Does the macro run sometimes and not others? If so, any chance the filename of the folder or image that blows up is the problem? I recall there was a bug in GetMedia for some characters in the filenames. Perhaps that's related?

    cheers,
    doug.

     

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Jul 21, 2009 @ 10:55
    Thomas Höhler
    0

    Two things what I can see at the first view. First a samll suggestion to use "xsl:choose" instead of two or three "xsl:if". So you can achieve an "if else" solution.

    The second thing is that you are using the getMedia with recursive = false. Why? Don't you want to iterate through the medias? with recursive = true you get all medias starting with the media id in one structure which you can iterate through. Am I wrong with my purpose? Also use xsl:copy-of to get the xml out of the current node to debug.

    hth, Thomas

  • Heather Floyd 610 posts 1032 karma points MVP 6x c-trib
    Jul 21, 2009 @ 17:54
    Heather Floyd
    0

    Thanks for your replies!

    @Doug: It saves just fine, When I place the macro in a template and run the page, I get the error instead of the output. I have tried "?umbDebugShowTrace=true" - but when I scroll down, I never see any obvious error (no red message). I have noticed that If I comment out the call to IterateMedia in the check for the Folder, it will render the thumbnails for media not in a folder.

    @Thomas: I will try to clean up the ifs... I tried with various true/false options on GetMedia, it didn't make any difference in the output. At this point, I was just trying to get each media item individually, via an integer MediaID value, and process them independently of one another... Am I misunderstanding how GetMedia() operates?

    Additional info:
    I'm not sure if this has anything to do with it, but the media to process is coming from a property on the page - "TestimonialRelatedPortfolioMEDIA", which uses a custom datatype based on TreeMultiPicker (http://treemultipicker.codeplex.com/)

    ~Heather

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Jul 21, 2009 @ 22:26
    Thomas Höhler
    0

    Hi Heather,

    I tested GetMedia with the true paremeter and it worked fine. Please try it and output it via xsl:copy-of instead of xsl:value-of then take a look into the html source. There you can see the complete xml which is returned where you then can iterate through.

    To your additional info. The node structure for medias are only given for the medias put in via the backend which you can see in the media section. Medias inserted on a content page via UploadField aren't stored in a hierarchy: they are flat.

    hth, Thomas

  • Heather Floyd 610 posts 1032 karma points MVP 6x c-trib
    Jul 22, 2009 @ 01:57
    Heather Floyd
    0

    Thanks, Thomas, for your feedback.

    The media items are stored in the Media Section - they are associated with a content node via the TreeMultiPicker-based property (similar to MultipleMediaPicker). The issue is that the TreeMultiPicker allows you to select individual media files (aka an image) and also allows you to select a media folder - which is handy, so you could add media to a media folder without having to update the content node with the additional items. But for display purposes, I have the ID of the folder, and I want to return all the images inside the media folder.

    It is possible I screwed up the GetMedi(x, true) at some point... 

    It occured to me that I might want to approach the entire problem from a different angle. If I could just "search" and compile a list of all the applicable media items, then I would be able to loop through them easier, and only output a certain number of them, if desired. To do this, I took a look at Doug's XSLTSearch files, and have managed to grab out little bits for my own purposes. My challenge is getting the syntax correct... Perhpas you can help me...

    This is what I am trying to use:

    <xsl:variable name="evenYetPossibleNodes" select="$yetPossibleNodes[contains($searchTerm,@path)]" />

    I have verified that $yetPossibleNodes does contain media nodes, and $searchTerm is returning a single Media Node Id... so supposedly, that MediaNodeId should be located in the path of some media nodes... but I am getting an empty list returned. Am I not formatting the "contains" statement correctly?

    Thanks!

    Heather

  • Heather Floyd 610 posts 1032 karma points MVP 6x c-trib
    Jul 22, 2009 @ 04:59
    Heather Floyd
    0

    I think my other issue will have to do with getting items regardles so far down the folder hierarchy they are... I can't seem to access them all "flat", without somehow traversing the hierarchy.

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Jul 22, 2009 @ 09:32
    Thomas Höhler
    1

    Hi Heather,

    I have no problem iterating through the media nodes cause they are similiar to the normal nodes. let me show you an example, perhaps it will get clearer.

    On my blog I have a media hierachy you can see in this picture.

    To get the medias from blog.thoehler.com I used the following xslt:

    <xsl:template match="/">
    <xsl:copy-of select="umbraco.library:GetMedia(1056, 'true')"/>
    </xsl:template>

    The results are shown on the website like in this picture.

    But if you rightclick and go to the html code you get an xml structure like this. So you can see that youhave an xml hierarchy which is the same like for content nodes. So now you can iterate through the items.

    The following xslt

    <xsl:template match="/">
    <ul>
    <xsl:for-each select="umbraco.library:GetMedia(1056, 'true')/node">
    <xsl:call-template name="WriteNode">
    <xsl:with-param name="mediaNode" select="current()"></xsl:with-param>
    </xsl:call-template>
    </xsl:for-each>
    </ul>
    </xsl:template>

    <xsl:template name="WriteNode">
    <xsl:param name="mediaNode"/>

    <li>
    Alias: <xsl:value-of select="@nodeTypeAlias" />, Nodename: <xsl:value-of select="@nodeName" />
    <xsl:if test="count(node) &gt; 0">
    <ul>
    <xsl:for-each select="umbraco.library:GetMedia(1056, 'true')/node">
    <xsl:call-template name="WriteNode">
    <xsl:with-param name="mediaNode" select="current()"></xsl:with-param>
    </xsl:call-template>
    </xsl:for-each>
    </ul>
    </xsl:if>
    </li>

    </xsl:template>

    gives the output you can see at http://blog.thoehler.com/test

    So if you only want to get the images in one list you can do something like

    <xsl:for-each select="umbraco.library:GetMedia(1056, 'true')/descendant-or-self::node [@nodeTypeAlias = 'Image']">

    I hope I could help you with this epic post ;-)

    Thomas

  • Heather Floyd 610 posts 1032 karma points MVP 6x c-trib
    Jul 24, 2009 @ 23:48
    Heather Floyd
    0

    Thanks, Thomas, with your examples I was able to get it to return correctly, and then with more research and work than it should have taken ;-) I managed to get it to display only the desired number of images (as passed in via the macro)

    So, what this does now, is it will take a content node and a propertyname (of a property which retuns a list of media nodes) and will create thumbnails of the number of items specified - regardless of how many levels "deep" it has to go to get the images. Phew!

    <?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:Designit.VideoEmbed="urn:Designit.VideoEmbed"
        xmlns:msxsl="urn:schemas-microsoft-com:xslt"
        xmlns:fi="urn:floydinnovations:xslt"
        exclude-result-prefixes="fi msxsl msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets Designit.VideoEmbed ">

    <!--Page_RelatedMediaThumbs.xslt-->

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

    <!--MACRO PARAMS:
        PageNode    The Page for which the links data should be returned (you can leave blank if using currentpage)    contenttree
        DataToReturn    What is the RelatedMedia Property?    propertyTypePicker
        UseCurrentPage    Use the current page rather than a specified page    bool
        ImageWidth    Width of Thumbnails (pixels)    (you only need to specify width OR height)    number
        ImageHeight    Height of Thumbnails (pixels) (you only need to specify width OR height)    number
        ShowCaption    Display the caption?    bool
        NumToShow    How many images should be displayed (leave blank for all)    number
    -->

    <xsl:param name="currentPage"/>
    <xsl:variable name="DataToReturn" select="macro/DataToReturn" />
    <xsl:variable name="propertyAlias" select="$DataToReturn"/>
    <xsl:variable name="PageNode" select="/macro/PageNode"/>
    <xsl:variable name="PageNodeSource" select="/macro/PageNode/node"/>
    <xsl:variable name="UseCurrentPage" select="/macro/UseCurrentPage"/>
    <xsl:variable name="ShowCaption" select="/macro/ShowCaption"/>
    <xsl:variable name="mImageWidth" select="/macro/ImageWidth"/>
    <xsl:variable name="mImageHeight" select="/macro/ImageHeight"/>

    <xsl:variable name="NumToShow">
        <xsl:if test="string(/macro/NumToShow) !=''">
            <xsl:value-of select="/macro/NumToShow"/>
        </xsl:if>
        <xsl:if test="string(/macro/NumToShow) =''">
            <xsl:value-of select="99999"/>
        </xsl:if>
    </xsl:variable>

    <xsl:variable name="ImageWidth">
        <xsl:if test="string($mImageWidth) !=''">
            <xsl:value-of select="$mImageWidth"/>
        </xsl:if>
        <xsl:if test="string($mImageWidth) =''">
            <xsl:value-of select="0"/>
        </xsl:if>
    </xsl:variable>

    <xsl:variable name="ImageHeight">
        <xsl:if test="string($mImageHeight)!=''">
            <xsl:value-of select="$mImageHeight"/>
        </xsl:if>
        <xsl:if test="string($mImageHeight)=''">
            <xsl:value-of select="0"/>
        </xsl:if>
    </xsl:variable>
    <xsl:variable name="ImageDimensions">
            <xsl:if test="number($ImageWidth) &gt; 0 and number($ImageHeight) &gt; 0">
                <xsl:value-of select="concat('&amp;Width=',$ImageWidth,'&amp;Height=',$ImageHeight,'&amp;Constrain=true')" />
            </xsl:if>
            <xsl:if test="number($ImageWidth) &gt; 0 and number($ImageHeight) &lt;= 0">
                <xsl:value-of select="concat('&amp;Width=',$ImageWidth)" />
            </xsl:if>
            <xsl:if test="number($ImageWidth) &lt;= 0 and number($ImageHeight) &gt; 0">
                <xsl:value-of select="concat('&amp;Height=',$ImageHeight)" />
            </xsl:if>
        </xsl:variable>

    <!--TEMPLATE: MAIN -->
    <xsl:template match="/">

    <xsl:variable name="AllMediaItems">
        <xsl:if test = "string($PageNodeSource) != ''">
            <xsl:value-of select="$PageNodeSource/data[@alias=$DataToReturn]"/>
        </xsl:if>
        <xsl:if test = "string($PageNodeSource) = ''">
            <xsl:value-of select="$currentPage/data[@alias=$DataToReturn]"/>
        </xsl:if>
    </xsl:variable>

    <xsl:variable name="MediaSplit" select="umbraco.library:Split($AllMediaItems, ',')" />
    <xsl:variable name="CountNodes" select="count($MediaSplit)"/>
    <!--{DEBUG-MediaSplit:<xsl:value-of select="$MediaSplit"/>}-->
    <xsl:for-each select="$MediaSplit/value">
    <!--<xsl:if test="position() &lt;= $NumToShow">-->
        <xsl:variable name="MediaSplitItem" select="." />
    <!--{DEBUG-MediaSplitItemValue:<xsl:value-of select="$MediaSplitItem"/>}-->
    <!--{DEBUG-MediaIterateItem:<xsl:copy-of select="umbraco.library:GetMedia($MediaSplitItem, 'true')"/>}-->
        <xsl:if test="$MediaSplitItem!=''">
            <xsl:call-template name="IterateMedia"> 
                <xsl:with-param name="MediaIterateItem" select="umbraco.library:GetMedia($MediaSplitItem, 'true')"/> 
            </xsl:call-template>
    <!--    </xsl:if>-->
    </xsl:if>
    </xsl:for-each>
    </xsl:template>

    <!--TEMPLATE: Iterate Media-->
    <xsl:template name="IterateMedia">
    <xsl:param name="MediaIterateItem"/> <!--media item node-->

        <!--{DEBUG-MediaIterateItem:<xsl:value-of select="$MediaIterateItem"/>}-->
        <!--{DEBUG-XML1:<xsl:copy-of select="$MediaIterateItem"/>}-->
        <xsl:variable name="MediaType" select="$MediaIterateItem/@nodeTypeAlias" />
            <!--{DEBUG-MediaType:<xsl:value-of select="$MediaType"/>}-->
           
        <xsl:if test="$MediaType !='Folder'">
            <xsl:call-template name="FormatMedia"> 
                <xsl:with-param name="MediaItem" select="$MediaIterateItem"/>
            </xsl:call-template>
        </xsl:if>
       
        <xsl:if test="$MediaType ='Folder'">
            <xsl:variable name="FolderID" select="$MediaIterateItem/@id"/>
            <!--{DEBUG-FolderID:<xsl:value-of select="$FolderID"/>}
            {DEBUG-COUNT:<xsl:value-of select="count(umbraco.library:GetMedia($FolderID, 'true')/node)"/>}-->
            <xsl:for-each select="umbraco.library:GetMedia($FolderID, 'true')/node">
                <!--{DEBUG-FolderItem:<xsl:copy-of select="current()"/>}-->
                <xsl:call-template name="IterateMedia"> 
                    <xsl:with-param name="MediaIterateItem" select="current()"/> 
                </xsl:call-template>
            </xsl:for-each>
       
        </xsl:if>

    </xsl:template>

    <!--TEMPLATE: Format Media Item-->
    <xsl:template name="FormatMedia">
    <xsl:param name="MediaItem"/> <!--media item node-->

    <xsl:variable name = "iCount" select = "fi:Increment()"/>
    <!--{Increment=<xsl:value-of select="$iCount"/>}-->
    <xsl:if test="$iCount &lt;= $NumToShow">
            <xsl:variable name="MediaItemURL" select="$MediaItem/data [@alias = 'umbracoFile']" />
            <xsl:variable name="FullImageURL"  select="concat('/umbraco/ImageGen.ashx?image=',$MediaItemURL, $ImageDimensions)" />
            <xsl:variable name="MediaItemCaption">
                <xsl:choose>
                    <xsl:when test="string($MediaItem/data [@alias = 'mediaImageCaption'])!=''">
                        <xsl:value-of select="$MediaItem/data [@alias = 'mediaImageCaption']"/>
                    </xsl:when>
                    <xsl:otherwise>
                         <xsl:value-of select="string('&nbsp;')" disable-output-escaping="yes"/>
                    </xsl:otherwise>
                </xsl:choose>
               
            </xsl:variable>
            <div class="RelatedMediaItem">
                <a href="{$MediaItemURL}">
                    <div class="RelatedMediaThumb">
                        <img class="RelatedMediaImg">
                              <xsl:attribute name="src">
                                    <xsl:value-of select="$FullImageURL"/>
                              </xsl:attribute>
                        </img>
                    </div>
                    <xsl:if test="$ShowCaption='1'">
                        <div class="RelatedMediaCaption">
                            <xsl:value-of select="$MediaItemCaption"/>
                        </div>
                    </xsl:if>
                </a>
            </div>
    </xsl:if>
    </xsl:template>


    <msxsl:script language="C#" implements-prefix="fi">

        public int iCount;
       
        public int Increment()
        {
            iCount=iCount+1;
            return iCount;
        }

    </msxsl:script>

    </xsl:stylesheet>

    I hope this code can help someone else who is attempting the same insanity!

     

    ~Heather

Please Sign in or register to post replies

Write your reply to:

Draft