Copied to clipboard

Flag this post as spam?

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


  • Martin 278 posts 662 karma points
    Jul 01, 2011 @ 11:37
    Martin
    0

    Show In Footer

    Hi all,

    I found a really good tutorial on Umbraco for beginners, at blogfodder.co.uk, but im having some issues with the Show in Footer feature. It has a master Docutype with a true/false option linked to a "show in footer" macro.

    Im having some trouble with it not showing anything. Any help would be grateful.

    Thanks

    Martin

    The macro XSLT is 

    <?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:template match="/">
    <ul>
            <xsl:for-each select="$currentPage/ancestor-or-self::node/descendant-or-self::node/node [string(data[@alias='ShowInFooter']) = '1']">
                    <li>                    
                        <a href="{umbraco.library:NiceUrl(@id)}">
                            <xsl:value-of select="@nodeName" />
                        </a>
                    </li>
                </xsl:for-each>
    </ul>
    </xsl:template>
    
    </xsl:stylesheet>

  • Rich Green 2246 posts 4008 karma points
    Jul 01, 2011 @ 11:44
    Rich Green
    0

    Hey,

    This code is for a pre 4.5 version of Umbraco, what version of Umbraco are you using (at the time of writing the latest is 4.7)

    If so, try changing this line

    <xsl:for-eachselect="$currentPage/ancestor-or-self::node/descendant-or-self::node/node [string(data[@alias='ShowInFooter']) = '1']">

    to

    <xsl:for-each select="$currentPage/ancestor-or-self::node/descendant-or-self::node/* [@isDoc][string(ShowInFooter) = '1']">h
  • Rich Green 2246 posts 4008 karma points
    Jul 01, 2011 @ 11:46
    Rich Green
    0

    Sorry about the formatting, can't edit, try changing

    <xsl:for-each select="$currentPage/ancestor-or-self::node/descendant-or-self::node/* [@isDoc][string(ShowInFooter) = '1']">

    To

    <xsl:for-each select="$currentPage/ancestor-or-self::node/descendant-or-self::node/* [@isDoc][string(ShowInFooter) = '1']">

     Rich

  • Martin 278 posts 662 karma points
    Jul 01, 2011 @ 11:57
    Martin
    0

    Thanks Rich, 
    Im using the new version 4.7

  • Rich Green 2246 posts 4008 karma points
    Jul 01, 2011 @ 11:59
    Rich Green
    0

    Hey Martin,

    Did you try the fix?

    Rich

  • Martin 278 posts 662 karma points
    Jul 01, 2011 @ 12:25
    Martin
    0

    OK, false start. Im still having issues.

    my xslt is :

    <?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:template match="/">
    <ul>
            <xsl:for-each select="$currentPage/ancestor-or-self::node/descendant-or-self::node/* [@isDoc][string(showInFooter) = '1']">
                    <li>                    
                        <href="{umbraco.library:NiceUrl(@id)}">
                            <xsl:value-of select="@nodeName" />
                        </a>
                    </li>
                </xsl:for-each>
    </ul>
    </xsl:template>

    </xsl:stylesheet>

  • Rich Green 2246 posts 4008 karma points
    Jul 01, 2011 @ 12:35
    Rich Green
    0

    Sorry, my bad, try this

     

     

    <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:template match="/">
      <xsl:variable name="currentSiteRoot" select="$currentPage/ancestor-or-self::* [@isDoc]" />
    <ul>
    <xsl:for-each select="$currentSiteRoot/descendant::* [@isDoc and string(showInFooter) = '1']">
    <li>
    <a href="{umbraco.library:NiceUrl(@id)}">
    <xsl:value-of select="@nodeName"/>
    </a>
    </li>
    </xsl:for-each>
    </ul>
    </xsl:template>
    </xsl:stylesheet>

     

    Rich

  • Martin 278 posts 662 karma points
    Jul 01, 2011 @ 12:40
    Martin
    0

    Thanks Rich, Im new to XSLT, but its gonna take practice.

    Thanks again.

  • Rich Green 2246 posts 4008 karma points
    Jul 01, 2011 @ 12:43
    Rich Green
    0

    No problem, did you get it working ok?

    Rich

  • Martin 278 posts 662 karma points
    Jul 01, 2011 @ 12:46
    Martin
    0

    Yeah, its works great.

    Thanks 

  • Rich Green 2246 posts 4008 karma points
    Jul 01, 2011 @ 12:50
    Rich Green
    0

    No problem, glad to hear you got it working.

    For your info the XML schema changed in Umbraco 4.5 (about June 2010) so there's alot of 'legacy' xslt samples on the internet, this is why you had problems with the original script.

    If you see '@nodeTypeAlias' anywhere in a code sample then this is old xslt.

    Cheers

    Rich

Please Sign in or register to post replies

Write your reply to:

Draft