Copied to clipboard

Flag this post as spam?

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


  • Jamie 35 posts 87 karma points
    Sep 19, 2011 @ 11:29
    Jamie
    0

    Counting children nodes descriminating by doc type

    I have a fairly normal umbraco tree structure of document types which get looped through to build a menu and this is all OK. However I have made a doc type called "MasterLinks" which contains a doc type  "LinkGroup" which contains "Links"  - the idea here being that an xslt on the temaplate for the Masterlinks page will write out a nicely formatted group of links as  strucutered by the child docs.

    My problem is this structure is being called out in my main menu - there are a lot of links here. An instead of settign umbraconaviHide on all the children [and training and getting the end user to remember to set this] I want to ignore all the children of the children of the MasterLinks doc [I don't want this page to be hidden so I can't simple umbraconaviHide on this Document Type]

    This is the If that decides if I am going to call the template.

    Tried things like name != "LinkGroup" but it seems to not affect the result.


     <xsl:if test="count(child::*[@isDoc] /* [string(umbracoNaviHide) != '1' and name!= "LinkGroup"]) &gt; 0 and $currentPage/ancestor-or-self::*/@id = @id">

        <ul>  

            <xsl:call-template name="drawNodes">
              <xsl:with-param name="parent" select="."/>
            </xsl:call-template>
        </ul>
    </xsl:if>

  • Tom Hare 49 posts 81 karma points
    Sep 19, 2011 @ 11:53
    Tom Hare
    0

    Hi Jamie,

    You could use @nodeType and match it to the node ID for the LinkGroup document type. It wouldn't be the most flexible solution if you're moving it across installations but for a one-off it should do the job.

    <xsl:if test="count(child::*[@isDoc] /* [string(umbracoNaviHide) != '1' and @nodeType!= ##THE ID## ]) &gt; 0 and $currentPage/ancestor-or-self::*/@id = @id">

    Tom

  • Jamie 35 posts 87 karma points
    Sep 20, 2011 @ 04:09
    Jamie
    0

    Tom,

    It's the sort of 'problem' I can see reoccuring, would be nice to get a more flexible solution.

    This page
    http://our.umbraco.org/wiki/reference/xslt/45-xml-schema/xslt-examples-updated-to-new-schema 

    gives the following 

     

    For Each child node excluding a specfic Document Type Alias

    New

    select="$currentPage/*[not(self::NewsItem)]">

     

    But I can't seem to get the not clause integrated with my statement.

    Perhapse my best option is to add and attribute hideChildren to the main masterLinks node and check for that?

     

     

     

     

Please Sign in or register to post replies

Write your reply to:

Draft