Copied to clipboard

Flag this post as spam?

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


  • Shaun 248 posts 475 karma points
    Dec 16, 2009 @ 11:15
    Shaun
    0

    Probably a simple problem, but I could use a second pair of eyes.

    I have some xslt - see below

    <xsl:variable name="totalcount">
          <xsl:choose>
            <xsl:when test="$currentPage/@parentID = '1066'">         
              <xsl:value-of select="count($currentPage/node [string(data [@alias='umbracoNaviHide']) != '1'])"/>
            </xsl:when>
            <xsl:otherwise>
              <!--this is being called from the events by country page, count all the matching events for that country-->        
              <xsl:value-of select="99" />
            </xsl:otherwise>       
          </xsl:choose>     
        </xsl:variable>

        xx<xsl:value-of select="$totalcount"/>xx

    If the parent id is 1066 this returns the number of nodes below that page.

    If the parent id is not 1066 it should return the number 99.

    But for some reason it only ever returns "0", and i'm damned if I can see why.

    what have I missed?

     

  • Shaun 248 posts 475 karma points
    Dec 16, 2009 @ 11:29
    Shaun
    0

    I've worked it out. I shouldn't be using a value-of statement in my "otherwise" branch, an xsl text would do it.

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Dec 16, 2009 @ 11:32
    Douglas Robar
    0

    An <xsl:text> is a good solution.

    Alternatively, you could use

    <xsl:value-of select="'99'" />

    Note the single quote marks inside the select statement.

    cheers,
    doug.

  • Shaun 248 posts 475 karma points
    Dec 16, 2009 @ 11:47
    Shaun
    0

    aha! Thanks Doug!

Please Sign in or register to post replies

Write your reply to:

Draft