How to select all nodes with particular document type? (problem solved. thx)
Hi. I am currently building a website with umbraco. The structure is like this:
-- Home
-- About us
-- Resources
-----Latest News
---------News 1
---------News 2
---------News 3
---------News 4
-- Contact us
(etc)
For the document type:
(1) Home template
--- has property: NumberofItemsToDisplay ...
(2) LatestNewsPage template
--- has property: 'umbracoNaviHide' ...
(3) News template
--- has property: 'umbracoNaviHide', 'NewsHeader'...
What I want to do is to list latest 3 news on the home page. So I wrote a XSLT file as follow in the home page template:
Thanks Dirk. You code works perfect. But is there any way to make code more generic? like, dymatically search all nodes and find the "latest News" page?
I was just looking at this post in the hope that it would solve a simillar problem I've been having. But I can only see the post text, not the actual code snippets that should be in the grey boxes. Does anyone know why this is?
How to select all nodes with particular document type? (problem solved. thx)
Hi. I am currently building a website with umbraco. The structure is like this:
-- Home
-- About us
-- Resources
-----Latest News
---------News 1
---------News 2
---------News 3
---------News 4
-- Contact us
(etc)
For the document type:
(1) Home template
--- has property: NumberofItemsToDisplay ...
(2) LatestNewsPage template
--- has property: 'umbracoNaviHide' ...
(3) News template
--- has property: 'umbracoNaviHide', 'NewsHeader'...
What I want to do is to list latest 3 news on the home page. So I wrote a XSLT file as follow in the home page template:
[code]
Hi,
[code]
Thanks Dirk. You code works perfect. But is there any way to make code more generic? like, dymatically search all nodes and find the "latest News" page?
thanks
Hi,
sure that is possible... use umbraco.library.GetXmlAll() for this purpose.
[code][/code]
Hope this helps.
Regards,
/Dirk
Hi Dirk
Thanks for help. I tried the code, but it does not work.
[code]
[/code]
can you help me to fix it?
Hi,
try using
[code][/code]
or
[code][/code]
Regards,
/Dirk
Thanks Dirk. both your solutions work for me. By the way, what's the differece between "/descendant::node" and "//node"?
Thanks again.
Hi,
No difference, the latter is just a short hand notation of the first.
Here's a book on the xpath axis and their shortcuts: http://umbraco.org/documentation/books/xslt-basics/xpath-axes-and-their-shortcuts
Regards,
/Dirk
Thanks for your help Dirk.
Hi,
I was just looking at this post in the hope that it would solve a simillar problem I've been having. But I can only see the post text, not the actual code snippets that should be in the grey boxes. Does anyone know why this is?
Paul.
Haha, the original is here: http://forum.umbraco.org/yaf_postst8561_How-to-select-all-nodes-with-particular-document-type-problem-solved-thx.aspx
I just Googled part of the text to find it.
Thanks Sebastiaan, my brain is somewhat dead this afternoon. I've just been round the office trying the page on different systems.
Paul.
is working on a reply...