Copied to clipboard

Flag this post as spam?

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


  • Sean 141 posts 179 karma points
    Feb 23, 2011 @ 09:05
    Sean
    0

    selecting a node and it's children based on the name

    Hi There,

    I would like to create a secondary navigation menu based on certain node names and their children. Am I able to do this in a macro? If so can someone help me out with the syntax please?

    Thanks in advance.

    Sean

  • Rob Watkins 369 posts 701 karma points
    Feb 23, 2011 @ 10:47
    Rob Watkins
    1

    To match immediate children of any document type by node name containing the string "fish", you want something like:

     $currentPage/*[contains(@nodeName, 'fish')]

    There are various extension functions you can use for better matching, like case insensitive matching and regular expression matching.

    Give us a bit more detail about your structure and what you want and we'll come up with something useful! :o)

  • Sean 141 posts 179 karma points
    Feb 23, 2011 @ 11:11
    Sean
    0

    Hi Rob,

    Thanks for the reply.

    I have a document type that is specifically for the top of my page that is called "popups". I want to only display this in certain sections on the site and hide it from the regular navigation at the same time? Currently all of the pages are appearing in the navigation. I realise I will need to create 2 macros for this. Does that make sense?

     

     

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">


    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

    <xsl:template match="/">

    <!-- start writing XSLT -->

    </xsl:template>

    </xsl:stylesheet>

     

  • Rob Watkins 369 posts 701 karma points
    Feb 23, 2011 @ 11:44
    Rob Watkins
    0

    Aha, so the node name is the actual XML node name, the document type, not the text page name? Misunderstood, sorry?

    So, in that case, to select just popups is obviously easy:

    $currentPage/popups
    
    OR
    
    umbraco.library:GetXmlAll()//popups (if you want all popups everywhere)

    To get things that are NOT popups:

    $currentPage/*[name() != 'popups']

    Is that what you're after?

Please Sign in or register to post replies

Write your reply to:

Draft