Copied to clipboard

Flag this post as spam?

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


  • Clare 37 posts 117 karma points
    Dec 14, 2012 @ 17:50
    Clare
    0

    XSLT list items by document type from anywhere in the site structure

    Hi there,

    I would like to work out how, in xslt, to display all nodes of a particular document type no matter where they are in the content tree. This is the code I have to display them if they sit below the current page:

    <xsl:param name="currentPage"/>

    <xsl:template match="/">

    <xsl:for-each select="$currentPage/IPOPartner">

    <p>

    <a href="{umbraco.library:NiceUrl(@id)}">

    <xsl:value-of select="@nodeName"/>

    </a>

    </p>

     

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Dec 14, 2012 @ 18:23
    Dennis Aaen
    0

    Hi Clare,

    Try to use this code, and see if it solved your problem.

    <xsl:param name="currentPage"/>

    <xsl:template match="/">

    <xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc and and string(umbracoNaviHide) != '1']/POPartner">
      <p>

        <a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a>
      </p>

    </xsl:for-each>

    </xsl:template>

    Hope this can help you.

    /Dennis

  • Kim Andersen 1447 posts 2197 karma points MVP
    Dec 14, 2012 @ 21:13
    Kim Andersen
    1

    Hi Clare

    If you want to show all of the pages of a certain type in the entire content tree, you can go to the root of the site, and then run through all of the nodes with some code like this:

    <xsl:for-each select="$currentPage/ancestor-or-self::root//IPOPartner[@isDoc]">
    <p>
    <a href="{umbraco.library:NiceUrl(@id)}">
    <xsl:value-of select="@nodeName"/>
    </a>
    </p>
    </xsl:for-each>

     

    You can of course use the same selector in a apply-templates, but I just wanted to show you the correct xpath in your current context.

    Hope this helps a bit.

    /Kim A

  • Clare 37 posts 117 karma points
    Dec 15, 2012 @ 02:12
    Clare
    0

    Thanks so much that worked perfectly!

  • Kim Andersen 1447 posts 2197 karma points MVP
    Dec 16, 2012 @ 20:07
    Kim Andersen
    0

    Great to hear Clare!

    Please remember to mark an answer as the solution for further reference, and to help others that come across this post with the same or a similar problem.

    /Kim A

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies