1

Here is my code:

    <xsl:for-each select="/*/hundreds/hundred">
    <div class="page_spacer" />
    <div class="page_section" style="{./style}">
    <h2><xsl:value-of select="./label"/></h2>
    <xsl:value-of select="./descriptiontext" />
    <button onclick="javascript:window.location.href='{./viewalllink}'"><xsl:value-of select="./label" /></button>
    <br/>
    <xsl:for-each select="./contendors/contendor">
        <img class="locationthumb" src="/act/locationthumb/{../locid}"/>
    </xsl:for-each>
    </div>
    </xsl:for-each>

I am trying to obtain the locid value from the first loop of hundreds and use it within the second loop inside the img element. I thought maybe ../locid would insinuate using the parent.

Any help would be greatly appreciated.

1 Answer 1

1

Bind it to a variable:

<xsl:for-each select="/*/hundreds/hundred">
  <xsl:variable name="h" select="."/>
    <div class="page_spacer" />
    <div class="page_section" style="{./style}">
    <h2><xsl:value-of select="./label"/></h2>
    <xsl:value-of select="./descriptiontext" />
    <button onclick="javascript:window.location.href='{./viewalllink}'"><xsl:value-of select="./label" /></button>
    <br/>
    <xsl:for-each select="./contendors/contendor">
        <img class="locationthumb" src="/act/locationthumb/{$h/locid}"/>
    </xsl:for-each>
    </div>
    </xsl:for-each>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.