Copied to clipboard

Flag this post as spam?

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


  • Anthony Candaele 1197 posts 2049 karma points
    Apr 03, 2011 @ 07:52
    Anthony Candaele
    0

    problem with xslt

    Hi,

    I have a website running in Umbraco 4.7, I'm using the Business Starter Kit and the uMedia skin. The Business Starter Kit has a u.mediaSliders document type which stores banners for a slider.

    I have implemented the same functionality for a Portfolio Slider. This Portfolio Slider shows banners for project which I have done or participated in. This is my document tree:

    But the problem is that my Portfolio Slider isn't showing on my Portfolio page. It must be a problem with the xslt-code. This is the line that accesses the Portfolio Sliders node:

    <xsl:variable name="sliderNode" select="$currentPage/parent::*/child::*[@level=1]/portfolioSliders"/>

    But this doesn't work. The thing is that I don't know how I can access a node that is on the same level in the hierarchy as the current node.

    Does anybody know how I can access the Portfolio Sliders node from my Portfolio page?

    Thanks for your help,

    Anthony
    Belgium

  • Sascha Wolter 615 posts 1101 karma points
    Apr 03, 2011 @ 09:20
    Sascha Wolter
    1

    Hi Anthony,

    try this:

    $currentPage/parent::*[@isDoc]/*[@isDoc and name() = 'Portfolio Sliders']

    From the current page ('Portfolio') you go up one page (parent::*[isDoc], isDoc makes sure that you get only real nodes and not property/data fields), and then select the node named 'Portfolio Sliders' (*[@isDoc and name() = 'Portfolio Sliders']). Since the name might change pretty quickly it's safer to use the doc type on that (and if you have only one of these on that level):

    $currentPage/parent::*[@isDoc]/{name-of-your-'Portfolio Sliders'-doc-type}

    Hope that helps,

    Sascha

  • Anthony Candaele 1197 posts 2049 karma points
    Apr 03, 2011 @ 13:30
    Anthony Candaele
    0

    Hi Sasha,

    Thanks for your help, I tried your code, but it doesn't work.

    If I try this code:

    <xsl:variable name="sliderNode" select="$currentPage/parent::*/child::*[@level=2]"/>

    It does work.

    The only thing that I noticed, is that when I add a new portfolioSlider node, I have to republish the document tree before it is rendered in the webbrowser.

    greetings,

    Anthony

    Belgium

  • 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.

    Continue discussion

Please Sign in or register to post replies