Copied to clipboard

Flag this post as spam?

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


  • dominik 711 posts 733 karma points
    Nov 08, 2011 @ 16:35
    dominik
    0

    Get News item via XSLT from different folder

    Hello,

    I have got the following structure:

    en
    - Home
    - Content
    - News
       - News Item 1

     

    Now i want to create a xslt script which is included in the master template which loops through all News Items. THe NewsItems have the documentTypeAlias "NewsItem".

    Can somebody help?

    THanks

  • dominik 711 posts 733 karma points
    Nov 08, 2011 @ 16:44
    dominik
    0

    i got it working by using this xslt script:
    <xsl:for-each select="umbraco.library:GetXmlNodeById(1074)/NewsItem">

    is this possible without using a fix Id?

    So for example by selecting the root node of my news items. This is called "News"


    Thanks

  • Jan Skovgaard 11280 posts 23678 karma points MVP 12x admin c-trib
    Nov 08, 2011 @ 21:10
    Jan Skovgaard
    0

    Hi Dominik

    You should be able to fetch the XSLT by doing like this

    <xsl:variable name="newsRoot" select="$currentPage/ancestor-or-self::News" />

    <xsl:for-each select="$newsRoot/NewsItem>

    Does this work for you?

    /Jan

  • dominik 711 posts 733 karma points
    Nov 09, 2011 @ 07:47
    dominik
    0

    Hi Jan,

    Your script is not working :(

  • dominik 711 posts 733 karma points
    Nov 09, 2011 @ 08:02
    dominik
    0

    If i am using "follwing::News" it works but i think this will not work if i try to reach news from a sublevel.

    Any solutions?

  • Robin Nicholl 137 posts 277 karma points
    Nov 09, 2011 @ 17:25
    Robin Nicholl
    0

    When you create your XSLT file, select "List Sub Pages From A Changeable Source" from the "Choose a template" drop-down menu in the Create dialogue window. Then you open the Macro for this new XSLT file, go to the "Parameters" tab and:

    • enter "source" as the alias
    • enter source" as the name
    • choose "contentPicker" from the "Type" drop-down
    • click the Save button.

    Then go to "Settings: and select the template you want to add the XSLT to. When you add the XSLT to the template you will be asked to choose the source from which you want to display sub-pages, in your case News.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 12x admin c-trib
    Nov 11, 2011 @ 12:46
    Jan Skovgaard
    0

    Hi Dominik

    Hmm, try this instead <xsl:variable name="globalLinksRoot" select="$currentPage/ancestor-or-self::*[@isDoc]/News" />

    /Jan

  • 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