Copied to clipboard

Flag this post as spam?

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


  • Philip 13 posts 33 karma points
    Dec 13, 2010 @ 15:17
    Philip
    0

    Can I count every node in my site that has a particular doc type?

    Hi,

    I was wondering how I could count every node in my site that has the doc type 'TextImageData'?

    <xsl:value-of select="count(........//TextImageData)" /> 
    Thanks for any help.
    Philip

  • Dan 1285 posts 3917 karma points c-trib
    Dec 13, 2010 @ 15:27
    Dan
    1

    Hi Philip,

    You should be able to do it like this:

    <xsl:variable name="documentCount" select="count($currentPage/* [name() = 'TextImageData' and string(umbracoNaviHide) != '1'])"

    This is assuming you're using the new XML schema.  Hope this helps...

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    Dec 13, 2010 @ 15:45
    Chriztian Steinmeier
    0

    Hi Philip,

    You're actually pretty close :-)

    If you want to count all occurences, regardless of visibility (not accounting for umbracoNaviHide), do something like this:

    <xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::*[@level = 1]" />
    <xsl:value-of select="count($siteRoot//TextImageData)" />

    Using $siteRoot keeps the count within the current site - if you're not having multiple sites in the installation, you can replace *[@level = 1] with root, to get the total count.

    /Chriztian

  • Philip 13 posts 33 karma points
    Dec 13, 2010 @ 16:12
    Philip
    0

    EDIT: Nevermind, found it. Thanks again!

Please Sign in or register to post replies

Write your reply to:

Draft