Copied to clipboard

Flag this post as spam?

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


  • DavidS 17 posts 38 karma points
    Aug 19, 2010 @ 17:13
    DavidS
    0

    Pass current page node id to xslt macro

    I am currently doing the following:

    Snippet

     <umbraco:Macro Alias="[XSLT]NavigationFoodAndDrink" excludeJavascript="0" parent="1270" runat="server"></umbraco:Macro>

     

    As you can see, I've hardcorded the parent node id (1270). How can I dynamically pass the current page's parent node id?

    I've found this http://umbraco.org/documentation/books/macro-parameters-syntax/advanced-parameter-syntax but they don't really help with what I'm trying to do.

    Any way of doing this nicely?

    TIA,

    David

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Aug 19, 2010 @ 17:42
    Chriztian Steinmeier
    0

    Hi David,

    Have you tried [#parentID] ? Based on that page's examples, that would be how to do it, I'd say...

    /Chriztian

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Aug 19, 2010 @ 17:43
    Stefan Kip
    0

    Don't pass it as parameter...

    You can access it in XSLT itself. By default this is included in your XSLT:

    <xsl:param name="currentPage"/>

    You can then access the parent with this:

    <xsl:value-of select="$currentPage/.."/>
  • DavidS 17 posts 38 karma points
    Aug 19, 2010 @ 21:44
    DavidS
    0

    @Chriztian: I don't that will work because it's not a docType defined property but I'll give it a go tomorrow morning.

    @kipusoep: My apologies for not giving more details but I have that code snippet in a master page and I need to pass the parent node id from the master page to an XSLT macro.

    Anyway, thank you both for taking the time to read and answer my query.

     

    David

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Aug 19, 2010 @ 21:49
  • DavidS 17 posts 38 karma points
    Aug 19, 2010 @ 22:08
    DavidS
    0

    Aha!! This looks like it could do the trick. I'll try it tomorrow morning and let you know what happens.

Please Sign in or register to post replies

Write your reply to:

Draft