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".
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.
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
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
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
Hi Jan,
Your script is not working :(
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?
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:
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.
Hi Dominik
Hmm, try this instead <xsl:variable name="globalLinksRoot" select="$currentPage/ancestor-or-self::*[@isDoc]/News" />
/Jan
is working on a reply...
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.