xsl-list
[Top] [All Lists]

Re: [xsl] How to get cotext of foreach caller

2006-12-09 13:31:51
On 12/9/06, PiGalKOM <pigalkom(_at_)poczta(_dot_)onet(_dot_)pl> wrote:
Hello,

  I have small problem:
Here is part of XML:
<parent>
      <list>
           <item>1</item>
           <item>1</item>
           <item>1</item>
           <item>1</item>
      </list>
      <child para="123">
           qwerty
     </child>
</parent>
<parent>
....
</parent>
....
And here is part of <xsl:transform version="1.0"...>


  <xsl:template match="child">
              <xsl:for-each select="/parent/list/item">
                    <xsl:value of select="?????????????/@para"/>
              </xsl:for-each>
          </form>
      </tr>     </xsl:template>

The problem is how to get value of parameter @para of <child> node
(point of loop call) from for-each loop (where context is
/parent/list/item )

Use a variable:

<xsl:template match="child">
 <xsl:variable name="this" select="."/.
 <xsl:for-each select="/parent/list/item">
   <xsl:value of select="$this/@para"/>

cheers
andrew

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>