Copied to clipboard

Flag this post as spam?

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


  • Vincent DeCapite 64 posts 83 karma points
    Nov 24, 2010 @ 18:56
    Vincent DeCapite
    0

    Sort Order Images

    Hi All,

    I have created an XSLT where when a user imports images into a library, the get put into a flash rotation thing, kind of like a banner. The problem I am running into is when a user tries to sort the images using the sort funtion in Umbraco. They show that there sorted in the umbraco admin tool, but they do not become sorted on the website. I don't know if I am missing a sort function in my code or what. I tried putting a sort function on the nodeID in the SlideShowXML.XSLT but that didn't work. Any help would be greatly appreaciated. Thank You.

    Here are the pieces of code though that work with the Slide Show Images:

    SlideShow.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:wsc.library="urn:wsc.library"
     
    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib wsc.library ">
    <xsl:output method="html" omit-xml-declaration="yes"/>
    <xsl:param name="currentPage"/>
    <xsl:param name="slides" select="/macro/slides/node" />
    <xsl:template match="/">
    <xsl:choose>
     
    <xsl:when test="umbraco.library:RequestServerVariables('SCRIPT_NAME') = '/umbraco/macroResultWrapper.aspx'">
     
    <xsl:call-template name="editor" />    
       
    </xsl:when>
       
    <xsl:otherwise>
         
    <xsl:call-template name="main" />
       
    </xsl:otherwise>
    </xsl:choose>
    </xsl:template>
    <!-- MAIN -->
    <xsl:template name="main">
    <xsl:if test="$slides/@nodeTypeAlias = 'Slides'">
    <div id="slideShow"></div>
    <script type="text/javascript">
    <xsl:text>var dataFile = '/SlideShowXMl.aspx?id=</xsl:text>
    <xsl:value-of select="$slides/@id" />
    <xsl:text>';</xsl:text>
    <![CDATA[
    var flashvars = {dataFile: dataFile};
    var params = { wmode:'transparent'};
    var attributes = {};
    swfobject
    .embedSWF('/elements/flash/InteriorSlideshow.swf', 'slideShow', '680', '300', '9.0.0', '', flashvars, params, attributes);
    ]]>
    </script>
    </xsl:if>
    </xsl:template>
    <!-- EDITOR -->
    <xsl:template name="editor">
     
    <h2>WSC.SlideShow</h2>
    </xsl:template>
    </xsl:stylesheet>

    SlideShowXML.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:wsc.library="urn:wsc.library"
     
    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib wsc.library ">
    <xsl:output method="xml" omit-xml-declaration="yes"/>
    <xsl:param name="currentPage"/>
    <xsl:variable name="mediaID" select="umbraco.library:Request('id')" />
    <xsl:template match="/">
    <xsl:value-of select="umbraco.library:ChangeContentType('text/xml')"/>
    <slides>
    <xsl:if test="number($mediaID)">
     
    <xsl:variable name="slides" select="umbraco.library:GetMedia($mediaID, 'True')" />
     
    <xsl:for-each select="$slides//node [data [@alias ='active'] = 1 and data [@alias = 'umbracoFile'] !='']">
     
    <slide name="{@nodeName}">
         
    <xsl:attribute name="file">
             
    <xsl:choose>
                 
    <xsl:when test="data [@alias = 'umbracoFile']">
                 
    <xsl:text>/umbraco/imagegen.ashx?width=402&amp;compression=100&amp;image=</xsl:text>
                   
    <xsl:value-of select="umbraco.library:UrlEncode(data [@alias = 'umbracoFile'])" />
                 
    </xsl:when>
                   
    <xsl:otherwise>
                 
    <xsl:value-of select="data [@alias = 'umbracoFile']" />
                   
    </xsl:otherwise>
               
    </xsl:choose>
           
    </xsl:attribute>        
         
    <xsl:attribute name="link">
             
    <xsl:choose>
                 
    <xsl:when test="data [@alias = 'externalLink'] != ''">
                     
    <xsl:value-of select="data [@alias = 'externalLink']" />
                   
    </xsl:when>
                   
    <xsl:when test="number(data [@alias = 'internalLink'])">
                     
    <xsl:value-of select="umbraco.library:NiceUrl(data [@alias = 'internalLink'])" />
                   
    </xsl:when>
               
    </xsl:choose>        
           
    </xsl:attribute>
       
    </slide>
       
    </xsl:for-each>
    </xsl:if>
    </slides>
    </xsl:template>
    </xsl:stylesheet>

    So far I have tried three different techniques for sort and none of them seem to be working. By the way I am on Umbraco version 4.0.3

    Here are the three options I have tried so far:

    <xsl:sort select="@sortOrder" data-type="number" order="ascending" />
    <xsl:sort select="data [@alias = 'Community Involvement']" order="ascending"/>
    <xsl:sort select="data [@alias = 'Slides]" order="ascending"/>
    Any help would be greatly appreciated.. Thank You.
  • Vincent DeCapite 64 posts 83 karma points
    Nov 24, 2010 @ 19:00
    Vincent DeCapite
    0

    So far I have tried three different techniques for sort and none of them seem to be working. By the way I am on Umbraco version 4.0.3

    Here are the three options I have tried so far

    <xsl:sort select="@sortOrder" data-type="number" order="ascending" />
    <xsl:sort select="data [@alias = 'Community Involvement']" order="ascending"/>
    <xsl:sort select="data [@alias = 'Slides]" order="ascending"/>


    Any help would be greatly appreaciated. Thanks

Please Sign in or register to post replies

Write your reply to:

Draft