Copied to clipboard

Flag this post as spam?

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


  • Brent 29 posts 240 karma points
    Sep 07, 2017 @ 20:25
    Brent
    0

    XLST Macro is not working...

    Hi,

    I'm trying to run this macro that I imported from Umbraco 4, but keep getting a "The XSLT didn't generate any output" message. Any ideas on where to look to fix this issue?

    <?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:ferinet="urn:ferinet"        
          xmlns:random="urn:random"        
          exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ferinet">
    
        <xsl:output method="xml" omit-xml-declaration="yes"/>
        <xsl:param name="currentPage"/>
    
        <xsl:template match="/">   
    
        <xsl:variable name="images" select="$currentPage/imageFolder"/>
        <xsl:variable name="imgWidth" select="704"/>
        <xsl:variable name="imgHeight" select="297"/>
    
        <xsl:if test="$images">
          <xsl:variable name="mediaNode" select="umbraco.library:GetMedia($images, 'true')" />
          <xsl:variable name="numImages" select="count($mediaNode/RotatorImage [string(umbracoNaviHide) != '1'])"/>
    
          <xsl:choose>
    
            <xsl:when test="$numImages = 0">
            </xsl:when>
            <xsl:when test="$numImages = 1">
              <xsl:for-each select="umbraco.library:GetMedia($images, 'true')/RotatorImage [string(umbracoNaviHide) != '1']">
    
                <xsl:variable name="url">
                  <xsl:choose>
                    <xsl:when test="./externalLink != ''" >
                      <xsl:value-of select="./externalLink"/>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:value-of select="umbraco.library:NiceUrl(./link)"/>
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:variable>
    
                <xsl:variable name="image" select="./umbracoFile"/>
                <a href="{$url}">        
                  <img src="/ImageGen.ashx?image={$image}&amp;width={$imgWidth}&amp;height={$imgHeight}" height="{$imgHeight}" width="{$imgWidth}" border="0"/>
                </a>
              </xsl:for-each>   
            </xsl:when>
    
            <xsl:otherwise>
    
              <!-- SHOW SLIDES -->
              <div id="container">
               <div id="slideshow">
                  <ul id="slides">
                  <xsl:for-each select="umbraco.library:GetMedia($images, 'true')/RotatorImage [string(umbracoNaviHide) != '1']">
    
                  <xsl:variable name="url">
                    <xsl:choose>
                      <xsl:when test="./externalLink != ''" >
                        <xsl:value-of select="./externalLink"/>
                      </xsl:when>
                      <xsl:otherwise>
                        <xsl:value-of select="umbraco.library:NiceUrl(./link)"/>
                      </xsl:otherwise>
                    </xsl:choose>
                  </xsl:variable>
    
                    <xsl:variable name="image" select="./umbracoFile"/>
                    <li><a href="{$url}"> 
                  <img border="0" style="" width="704" height="297">
                  <xsl:attribute name="src">
                <xsl:text>/ImageGen.ashx?image=</xsl:text>
                       <xsl:value-of select="$image"/>
                <xsl:text>&amp;height=297</xsl:text>
                <xsl:text>&amp;width=704</xsl:text>
                  </xsl:attribute>
                  </img>
                </a></li>
                  </xsl:for-each>   
                  </ul>  
           <ul id="nav">
                   <li id="prev"><a href="#">&nbsp;</a></li>
                   <li id="next"><a href="#">&nbsp;</a></li>
                  </ul>      
                </div>      
              </div>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:if>
    
    
            </xsl:template>
        </xsl:stylesheet>
    
  • Brent 29 posts 240 karma points
    Sep 07, 2017 @ 20:44
    Brent
    0

    I did notice this in both versions. I have tried checking the "Render in Rich text editor and the grid" box, but it won't let me check it without checking the one above it as well. If checked it has the same result. Not sure if this helps or not.

    enter image description here

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    Sep 07, 2017 @ 21:11
    Chriztian Steinmeier
    0

    Hi Brent,

    Here's a couple of quick thoughts:

    • The macro expects the page it's running on to have an imageFolder property - does your page(s) have that? (Looks like it should be a MediaPicker, selecting only folders, I guess).

    • If the picked folder doesn't contain any images (or only has images with ?umbracoNaviHide checked) it won't output anything either.

    Hope that helps you debug it,

    /Chriztian

  • Brent 29 posts 240 karma points
    Sep 08, 2017 @ 14:35
    Brent
    0

    Thanks Christian.

    The page does have a image folder property and it is selecting the image within a folder.

    The umbraconavihide wasn't checked because it wasn't a property on the images.

    With your recommendation I was able to notice that a Media Type that these images used to be on was not available to choose from.

    I added it and tried to create the same properties. It will show up now if I upload an image in any folder or in root, but it still won't visualize the XLST file after these changes were made.

    Still researching... Any additional thoughts are welcomed.

Please Sign in or register to post replies

Write your reply to:

Draft