Copied to clipboard

Flag this post as spam?

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


  • Brian Olsen 143 posts 424 karma points
    Dec 10, 2012 @ 20:33
    Brian Olsen
    0

    test and inset images if is not empty menuThumbnail

    umbraco v 4.7.1.1

    I can not find out how I make a test on whether my field is empty and if not then insert an image

    at <!--- menuThumbnail -->

    field menuThumbnail 

     

     

    <?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" 
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">

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

    <xsl:param name="currentPage"/>
    <xsl:param name="mediaFolder" select="$currentPage/menuThumbnail" />

        
    <!-- update this variable on how deep your site map should be -->
    <xsl:variable name="maxLevelForSitemap" select="4"/>

    <xsl:template match="/">

          <xsl:call-template name="drawNodes">  
              <xsl:with-param name="parent" select="$currentPage/ancestor-or-self::* [@isDoc and @level=1]"/>  
          </xsl:call-template>

    </xsl:template>

    <xsl:template name="drawNodes">
      <xsl:param name="parent"/> 
      <xsl:if test="umbraco.library:IsProtected($parent/@id, $parent/@path) = 0 or (umbraco.library:IsProtected($parent/@id, $parent/@path) = 1 and umbraco.library:IsLoggedOn() = 1)">
              
              
                <xsl:for-each select="$parent/* [@isDoc and string(umbracoNaviHide) != '1' and @level &lt;= $maxLevelForSitemap]">
                                               
                      
                  
                         <xsl:if test="count(./* [@isDoc and string(umbracoNaviHide) != '1' and @level &lt;= $maxLevelForSitemap]) &gt; 0">   
                              <xsl:call-template name="drawNodes1">    
                                  <xsl:with-param name="parent" select="."/>    
                              </xsl:call-template>  
                         </xsl:if
                    
                        

                </xsl:for-each>

      </xsl:if>
    </xsl:template>
      


        <xsl:template name="drawNodes1">
      <xsl:param name="parent"/> 
      <xsl:if test="umbraco.library:IsProtected($parent/@id, $parent/@path) = 0 or (umbraco.library:IsProtected($parent/@id, $parent/@path) = 1 and umbraco.library:IsLoggedOn() = 1)">
      
         <xsl:text disable-output-escaping="yes">&lt;div id=&quot;</xsl:text><xsl:value-of select="@urlName"/><xsl:text disable-output-escaping="yes">&quot; style="visibility:hidden;" onMouseOver=&quot;show('</xsl:text><xsl:value-of select="@urlName"/><xsl:text disable-output-escaping="yes">')&quot; onMouseOut=&quot;hide('</xsl:text><xsl:value-of select="@urlName"/><xsl:text disable-output-escaping="yes">')&quot; class=&quot;undermenu&quot;&gt;</xsl:text>           
                <xsl:for-each select="$parent/* [@isDoc and string(umbracoNaviHide) != '1' and @level &lt;= $maxLevelForSitemap]"


                 

              
                  
                  
                  
                         <href="{umbraco.library:NiceUrl(@id)}">
                           <xsl:value-of select="@nodeName"/>
                  </a
                  <xsl:if test="menuThumnail !=''">
                   
                  </xsl:if>
                  
                  
                 <!-- menuThumbnail -->
                                
                         <xsl:if test="count(./* [@isDoc and string(umbracoNaviHide) != '1' and @level &lt;= $maxLevelForSitemap]) &gt; 0">   
                              <xsl:call-template name="drawNodes">    
                                  <xsl:with-param name="parent" select="."/>    
                              </xsl:call-template>  
                           
                         </xsl:if

                </xsl:for-each>
        <xsl:text disable-output-escaping="yes">&lt;/div&gt;</xsl:text>
          
      </xsl:if>
          
    </xsl:template>
        
    </xsl:stylesheet>

Please Sign in or register to post replies

Write your reply to:

Draft