Copied to clipboard

Flag this post as spam?

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


  • Amir Khan 1199 posts 2567 karma points
    Apr 20, 2010 @ 06:08
    Amir Khan
    0

    Change macro contents based on parent node

    So what I'd like to do is render some basic text, rotating quotes specifically, based on which language section the user is on. So if they are under a certain node, render English, under another, render French, etc. I'm not sure where I'm going wrong here, but I think I'm getting close, any help would be greatly appreciated!

     

    <xsl:template match="/">
    <xsl:for-each select="$currentPage/ancestor-or-self::node [@level=$level]/node [string(data [@alias='umbracoNaviHide']) != '1']">
    <ul class="Quotes">
     <li>some enlish quotes</li>
    </ul>

    </xsl:for-each>
    <xsl:if test="count($currentPage/ancestor-or-self::node [@level = $1222]/node) &gt; 0">
    <ul class="Quotes">
     <li>some frend quotes</li>
    </ul>
    </xsl:if></xsl:template>

  • Amir Khan 1199 posts 2567 karma points
    Apr 20, 2010 @ 07:19
    Amir Khan
    0

    Got it!

    <?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="/">
            <xsl:if test="$currentPage/ancestor-or-self::node/@id = 1077">
                    <ul id="quotes">
                        <li>english quote</li>
                    </ul>
            </xsl:if>
        <xsl:if test="$currentPage/ancestor-or-self::node/@id = 1282">
                    <ul id="quotes">
                    <li>french quote</li>
                    </ul>
            </xsl:if>


    </xsl:template>

    </xsl:stylesheet>

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies