Copied to clipboard

Flag this post as spam?

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


  • Thomas Nielsen 4 posts 24 karma points
    Feb 18, 2012 @ 22:40
    Thomas Nielsen
    0

    Recursive field in XSLT

    Hi :)

    Have tried to get an XSLT field recursivly - but no succes, tried this code: any ideas..

    <xsl:value-of select="$currentPage/ancestor-or-self::node [string(data[@alias='pageDescription'])!=''] [position()=last()] /data[@alias='pageDescription']"/>

     

    Thanks in advance!


    Thomas

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Feb 18, 2012 @ 23:10
    Chriztian Steinmeier
    0

    Hi Thomas,

    It's not totally far off, but it's written for the "legacy XML schema" (and there it will take the value from the furthest ancestor - not the closest).

    Here's an updated version:

    <xsl:value-of select="$currentPage/ancestor-or-self::*[normalize-space(pageDescription)][1]/pageDescription" />

    (If you still need it to be the old format - use this:)

    <xsl:value-of select="$currentPage/ancestor-or-self::node[normalize-space(data[@alias = 'pageDescription'])][1]/data[@alias = 'pageDescription']" />

    /Chriztian

  • Thomas Nielsen 4 posts 24 karma points
    Feb 18, 2012 @ 23:31
    Thomas Nielsen
    0

    Thank you so much :) solved my problem

     

     

Please Sign in or register to post replies

Write your reply to:

Draft