Copied to clipboard

Flag this post as spam?

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


  • Katlynn 18 posts 89 karma points
    Oct 12, 2018 @ 17:47
    Katlynn
    0

    Error Parsing Flickr Gallery xslt

    Hi there! I inherited a site using Umbraco that we're currently in the process of redesigning and moving. The current site was redone a few years back by a pretty shoddy third-party developer that just up and disappeared after the project was done well before I was hired by my company.

    So, the last of my two years has been spent trying to fix the issues this developer left behind; some have been easy, others are super weird and confusing. Full disclaimer, I'm generally a Wordpress, Drupal, or Joomla developer and while, I've learned Umbraco just fine over the last few years, it's still not my first language, ya feel me?

    This morning one of my colleagues let me know that the macro we use to pull in our flickr galleries on a page on our website "isnt working". I get to the page and see the "Error Parsing XSLT" language there.

    The language from the developer is below, and it looks like the macro asks for an api key and user id in the content side of things. I've never had to mess with the flickr api, nor have I had to work with this particular macro, so any help at all would be great!

    <?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:Examine="urn:Examine" xmlns:umbraco.contour="urn:umbraco.contour" xmlns:Social.FlickrGalleries="urn:Social.FlickrGalleries" xmlns:ucomponents.cms="urn:ucomponents.cms" xmlns:ucomponents.dates="urn:ucomponents.dates" xmlns:ucomponents.email="urn:ucomponents.email" xmlns:ucomponents.io="urn:ucomponents.io" xmlns:ucomponents.media="urn:ucomponents.media" xmlns:ucomponents.members="urn:ucomponents.members" xmlns:ucomponents.nodes="urn:ucomponents.nodes" xmlns:ucomponents.random="urn:ucomponents.random" xmlns:ucomponents.request="urn:ucomponents.request" xmlns:ucomponents.search="urn:ucomponents.search" xmlns:ucomponents.strings="urn:ucomponents.strings" xmlns:ucomponents.urls="urn:ucomponents.urls" xmlns:ucomponents.xml="urn:ucomponents.xml" xmlns:PS.XSLTsearch="urn:PS.XSLTsearch" 
        exclude-result-prefixes="msxml Social.FlickrGalleries umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets Examine umbraco.contour Social.FlickrGalleries ucomponents.cms ucomponents.dates ucomponents.email ucomponents.io ucomponents.media ucomponents.members ucomponents.nodes ucomponents.random ucomponents.request ucomponents.search ucomponents.strings ucomponents.urls ucomponents.xml PS.XSLTsearch ">
    
    <!-- Parameters -->
    <xsl:variable name="userId" select="/macro/userId" />
    <xsl:variable name="apiKey" select="/macro/apiKey" />
    <xsl:variable name="thumbSize" select="/macro/thumbSize" />
    
    <xsl:output method="xml" omit-xml-declaration="yes"/>
    <xsl:variable name="page">
        <xsl:choose>
            <xsl:when test="string-length(umbraco.library:RequestQueryString('page')) &gt; 0">
                <xsl:value-of select="umbraco.library:RequestQueryString('page')"/>
            </xsl:when>
            <xsl:otherwise>0</xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    <xsl:variable name="perPage" select="12" />     
    <xsl:variable name="startLoad" select="$page * $perPage" />
    <xsl:variable name="endLoad" select="$startLoad + $perPage" />      
    <xsl:variable name="albums" select="Social.FlickrGalleries:getAllAlbums($thumbSize, $apiKey , $userId)/albums/*"/>
    <xsl:variable name="totalPages" select="ceiling(count($albums))" />
    
    <xsl:param name="currentPage"/>
    
            <xsl:template match="/">        
                <h2>Albums</h2>
    
                <div class="row">
                    <div id="galleries" class="large-12 columns">
                        <ul class="small-block-grid-2 medium-block-grid-3" >
                            <xsl:for-each select="$albums [position() &lt;= $endLoad and position() &gt; $startLoad]">
                                <li>
                                    <div class="gallery-item">
                                        <div>
                                            <div class="clip"><img src="{thumbUrl}" alt="{title} Gallery" /></div>
                                            <h3><xsl:value-of select="title"/></h3>
                                        </div>
                                        <div>
                                            <a target="_blank" href="http://www.flickr.com/photos/{$userId}/sets/{id}" class="button">View</a>
                                        </div>
                                    </div>
                                </li>
                            </xsl:for-each>
                        </ul>
                    </div>
                    <xsl:if test="ceiling($totalPages div $perPage) &gt; 1">
                        <xsl:call-template name="paginationLinks" />
                    </xsl:if>
                </div>
    
            </xsl:template>
    
            <xsl:template name="paginationLinks">
                <ul class="pagination">
                    <xsl:call-template name="for.loop">
                    <xsl:with-param name="i">1</xsl:with-param>
                    <xsl:with-param name="page" select="$page + 1"></xsl:with-param>
                    <xsl:with-param name="count" select="ceiling($totalPages div $perPage)"></xsl:with-param>
                </xsl:call-template>
                </ul>
            </xsl:template>
    
            <xsl:template name="for.loop">
    
                <xsl:param name="i"/>
                <xsl:param name="count"/>
                <xsl:param name="page"/>
                <xsl:if test="$i &lt;= $count">
                    <li>
                    <xsl:if test="$page != $i">
                        <a href="{umbraco.library:NiceUrl($currentPage/@id)}?page={$i - 1}" >
                            <xsl:value-of select="$i" />
                        </a>
                    </xsl:if>
    
                    <xsl:if test="$page = $i">
    
                        <li class="current"><a href=""><xsl:value-of select="$i" /></a></li>
    
                    </xsl:if>
                    </li>
    
                </xsl:if>
                <xsl:if test="$i &lt;= $count">
                    <xsl:call-template name="for.loop">
                        <xsl:with-param name="i">
                            <xsl:value-of select="$i + 1"/>
                        </xsl:with-param>
                        <xsl:with-param name="count">
                            <xsl:value-of select="$count"/>
                        </xsl:with-param>
                        <xsl:with-param name="page">
                            <xsl:value-of select="$page"/>
                        </xsl:with-param>
                    </xsl:call-template>
                </xsl:if>
            </xsl:template>
    </xsl:stylesheet>
    
  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Oct 12, 2018 @ 20:18
    Chriztian Steinmeier
    0

    Hi Katlynn,

    It's very likely the call to Social.FlickrGalleries:getAllAlbums() that's returning an error. Could be the API is no longer available, or the $userId being used is no longer valid, or the $apiKey has expired/been revoked.

    Are you able to verify that the macro gets sent values for all the params? E.g., if it's placed in a template, you should be able to see a <umbraco:Macro> tag (if using MasterPages) or @Umbraco.RenderMacro()(if using Razor Views).

    /Chriztian

Please Sign in or register to post replies

Write your reply to:

Draft