Copied to clipboard

Flag this post as spam?

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


  • jing.ling 29 posts 20 karma points
    Mar 06, 2009 @ 03:26
    jing.ling
    0

    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]

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Mar 06, 2009 @ 08:32
    Dirk De Grave
    0

    Hi,

    [code]

  • jing.ling 29 posts 20 karma points
    Mar 08, 2009 @ 22:50
    jing.ling
    0

    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

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Mar 09, 2009 @ 09:55
    Dirk De Grave
    0

    Hi,

    sure that is possible... use umbraco.library.GetXmlAll() for this purpose.

    [code][/code]

    Hope this helps.

    Regards,
    /Dirk

  • jing.ling 29 posts 20 karma points
    Mar 10, 2009 @ 04:45
    jing.ling
    0

    Hi Dirk

    Thanks for help. I tried the code, but it does not work.

    [code]


    [/code]

    can you help me to fix it?

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Mar 10, 2009 @ 08:59
    Dirk De Grave
    0

    Hi,

    try using

    [code][/code]

    or

    [code][/code]

    Regards,
    /Dirk

  • jing.ling 29 posts 20 karma points
    Mar 10, 2009 @ 20:06
    jing.ling
    0

    Thanks Dirk. both your solutions work for me. By the way, what's the differece between "/descendant::node" and "//node"?

    Thanks again.

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Mar 10, 2009 @ 20:38
    Dirk De Grave
    0

    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

  • jing.ling 29 posts 20 karma points
    Mar 10, 2009 @ 23:17
    jing.ling
    0

    Thanks for your help Dirk.

  • Paul McGinnity 2 posts 21 karma points
    Jul 29, 2009 @ 16:28
    Paul McGinnity
    0

    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.

  • Sebastiaan Janssen 5045 posts 15476 karma points MVP admin hq
    Jul 29, 2009 @ 16:29
  • Paul McGinnity 2 posts 21 karma points
    Jul 29, 2009 @ 16:37
    Paul McGinnity
    0

    Thanks Sebastiaan, my brain is somewhat dead this afternoon. I've just been round the office trying the page on different systems.

    Paul.

Please Sign in or register to post replies

Write your reply to:

Draft