Copied to clipboard

Flag this post as spam?

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


  • Eduardo 106 posts 130 karma points
    Sep 15, 2010 @ 21:12
    Eduardo
    0

    Problems retrieving data from a child node.

    Greetings,

    I am trying to retrieve an alias value from three nodes under a parent node but, I am getting confused because I can't find the solution to the problem.

    - The XSLT that I am using to retrieve the data from the nodes.

    <xsl:variable name="identifier" select="/macro/id"/>
    <xsl:param name="currentPage"/>
    <xsl:template match="/">
      <ul>
        <xsl:attribute name="id">
          <xsl:value-of select="$identifier"/>
        </xsl:attribute>
        

        <xsl:for-each select="$currentPage//*">
       
          <xsl:if test="@nodeName != ''">
          <li>
            <img>
            <xsl:attribute name="src">

              <xsl:value-of select="//clientLog"/> <!-- I want to get the clientLogo alias from the child node -->
            </xsl:attribute>
          </img>
        </li>
        </xsl:if>
      </xsl:for-each>
    </ul>
    </xsl:template>


    Can anybody help please?

    Thanks beforehand.

    Regards,
    Eduardo Macho

     

  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    Sep 15, 2010 @ 21:21
    Chriztian Steinmeier
    0

    Hi Eduardo,

    Inside a for-each statement, the so-called "current node" in XSLT is the one currently being processed, so your XPaths in here just need to be relative to that node, so if you need a property you just call it by name:

    <xsl:value-of select="clientLog" />

    - or if you're using v.4.0:

    <xsl:value-of select="data[@alias = 'clientLog']" />'

    /Chriztian 

  • Eduardo 106 posts 130 karma points
    Sep 15, 2010 @ 21:26
    Eduardo
    0

    Hi Chriztian,

    Thank you very much, your answer helped me.

    Regards,
    Eduardo

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

Please Sign in or register to post replies