xsl-list
[Top] [All Lists]

RE: xsl needed: sibilings with different parents

2004-09-07 11:52:33
Easy in XPath 2.0:

for $i in 1 to count(BB/BB1)
return (BB/BB1[$i], AA/AA1[$i])

Just slightly more verbose in XSLT 1.0:

<xsl:variable name="root" select="."/>
<xsl:for-each select="BB/BB1">
  <xsl:variable name="i" select="position()"/>
  <xsl:copy-of select="."/>
  <xsl:copy-of select="$root/AA/AA1[$i]"/>
</xsl:for-each>

Michael Kay

-----Original Message-----
From: Anthony Ettinger [mailto:apwebdesign(_at_)yahoo(_dot_)com] 
Sent: 07 September 2004 18:47
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] xsl needed: sibilings with different parents

Hi,
 
I've the following document:
 
<root>
  <AA>
        <AA1/>
        <AA1/>
        <AA1/>
......
  </AA>
  <BB>
        <BB1/>
        <BB1/>
        <BB1/>
......
  </BB>
</root>
 
I need to loop on BB/BB1 and within the loop, I need
to use the index or position of BB/BB1 and access
AA/AA1 to get the corresponding AA/AA1's value each
time.
 
Any thoughts?
 
Thank you

=====
Anthony Ettinger
Phone: (408) 656-2473
apwebdesign(_at_)yahoo(_dot_)com
http://www.apwebdesign.com

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--+------------------------------------------------------------------
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>
--+--