Copied to clipboard

Flag this post as spam?

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


  • Anthony Candaele 1197 posts 2049 karma points
    Jun 24, 2011 @ 09:17
    Anthony Candaele
    0

    problem with Xslt

    Hi,

    I have a problem with Xslt. I wrote an Xslt-macro that reads all 'arrangements' from the 'ArrangementsArea' node. My content tree looks like this:

    To read out the Arrangement items ('meeneemlunch', 'picnic', 'pizzabuffet') on the home page, I put an Xslt-macro on the Master template. This is my Xslt-code:

    <xsl:template match="/">
      <ul class="nice-list">
        <xsl:for-each select="$currentPage/following-sibling::ArrangementArea/Arrangement[@isDoc]">
          <li><a href="{umbraco.library:NiceUrl(1076)}#{arrangementTitle}"><xsl:value-of select="arrangementTitle"/></a>
                  <div class="left"><a href="#">Introtekstje...</a></div>
                  <div class="right"><xsl:value-of select="umbraco.library:ShortDate(@createDate)"/></div>
                  <div class="clearer">&nbsp;</div>
                </li>

        </xsl:for-each>
      </ul>
    </xsl:template>

    The problem though is that the Arrangement items are only read out on the Homepage, and not on the other pages, like the 'Arrangements' page itself.

    I guess I have to change the XPath axis in my for-each loop, but I don't know how.

    Does anyone know how I can make the Arrangement items render on all pages, and not only on the Home page?

    Thanks for your help,

    Anthony Candaele
    Belgium

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    Jun 24, 2011 @ 09:25
    Chriztian Steinmeier
    1

    Hi Anthony,

    Create an intermediate variable that references your "Site" node, and use that  - it makes everything read much better:

    <xsl:param name="currentPage" />
    <xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::*[@level = 1]" />
    
    <xsl:template match="/">
        <ul class="nice-list">
            <xsl:for-each select="$siteRoot/ArrangementArea/Arrangement[@isDoc]">
                <li>
                    <a href="{umbraco.library:NiceUrl(1076)}#{arrangementTitle}"><xsl:value-of select="arrangementTitle"/></a>
                    <div class="left"><a href="#">Introtekstje...</a></div>
                    <div class="right"><xsl:value-of select="umbraco.library:ShortDate(@createDate)"/></div>
                    <div class="clearer">&nbsp;</div>
                </li>
            </xsl:for-each>
        </ul>
    </xsl:template>

    /Chriztian

  • Anthony Candaele 1197 posts 2049 karma points
    Jun 24, 2011 @ 10:16
    Anthony Candaele
    0

    Hi Chriztian,

    Problem solved! Thanks for the help, you rock!

    greetings,

    Anthony

Please Sign in or register to post replies

Write your reply to:

Draft