Copied to clipboard

Flag this post as spam?

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


  • pepefgd 1 post 21 karma points
    Aug 31, 2011 @ 05:34
    pepefgd
    0

    counting nodes, but repeating

    Hi, I'm beginnig learning xslt, and I have some problems counting the nodes while grouping a node list, for example this is my tree:

    <Countries>

             <Mexico>

                   <Guadalajara>

                          <Juarez>

                          <Hidalgo>

                   </Guadalajara>

             </Mexico>

             <Spain>

                   <Guadalajara>

                          <Cortes>

                   </Guadalajara>

             </Spain>

    </Countries>

     

    So, when a try to count the items in Guadalajara level always get 3 instead of 2 for the first one and 1 for de last one. And this is the way Im doing it, select="count($nodeset)" for each level. What am I doing wrong?

  • Fuji Kusaka 2203 posts 4220 karma points
    Aug 31, 2011 @ 05:58
    Fuji Kusaka
    0

    Hi can you try this

     <xsl:value-of select="count($parent/*[@isDoc and string(umbracoNaviHide) != '1'])" />
  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    Aug 31, 2011 @ 11:14
    Chriztian Steinmeier
    0

    Hi pepefgd,

    What do you select to get the $nodeset? Could you showe some of the code surrounding your count() statement - context is everything in XSLT, so it would help a lot to see what you're doing.

    /Chriztian

Please Sign in or register to post replies

Write your reply to:

Draft