[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xsl needed: sibilings with different parents

Subject: RE: xsl needed: sibilings with different parents
From: Anthony Ettinger <apwebdesign@xxxxxxxxx>
Date: Tue, 7 Sep 2004 14:53:50 -0700 (PDT)
sibilings
Thanks Michael, However in my architecture we have not
yet introduced variables.

Do you think something like this would work instead,
without using variables?

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

I'm actually not using straigt xsl, I have xml which
is transformed into xsl, and in my context I have
something like this:

<Iteration>
<RepeatingUnit>BB/BB1</RepeatingUnit>
<RepeatingAction>
<Result>/root/AA/[position of BB1]</Result> <-- xpath
can go here
</RepeatingAction>
</Iteration>


--- Michael Kay <mhk@xxxxxxxxx> wrote:

> 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@xxxxxxxxx] 
> > Sent: 07 September 2004 18:47
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject:  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@xxxxxxxxx
> > http://www.apwebdesign.com
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> > http://mail.yahoo.com 
> 
> 


=====
Anthony Ettinger
Phone: (408) 656-2473
apwebdesign@xxxxxxxxx
http://www.apwebdesign.com

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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.