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

for-each sort of thing in {} ?

Subject: for-each sort of thing in {} ?
From: "Carole E. Mah" <carole@xxxxxxxxxxxxxxxxxx>
Date: Thu, 8 Jun 2000 11:58:46 -0400 (EDT)
for each sort
I've currently got something like:

<foo>
 <bar id="farble1">
 <bar id="farble2">
 <bar id="farble3">
</foo>

And I want to grab all these id's and put them on an anchor's HREF value,
saving them as query paramters like this:

<a href="foo.php3?id1=farble1&id2=farble2&id3=farble3">

To do this, I have:
<xsl:template match="foo">
 <a 
href="foo.php3?
id1={bar/@id}&amp;id2={bar[position()=2]/@id}&amp;id3={bar[position()=3]/@id}">

</xsl:template>

This works quite well.

However, the number of <bar> elements inside any given <foo> element in
any given document instance may vary  (this is (bar+) in the content model
for <foo>).

What I really want then, is whatever (if it exists) the XSLT equivalent in
a <a href="foo.php3?{FOR-LIKE-THING}"> of this PHP-ish FOR idea: 
  $hrefValue = "";
  for (i=0;i<last();i++) {
    $appendMe = "&amp;id$i=bar/@id";
    # concatenate next id to href string
    $hrefValue .= $appendMe;
   }

I hope this analogy makes sense ( .= is the concatenation operator in
PHP).

thanks,
-carole
- - - - - - - - - - - - - - - - - - - - - - - - - - - 
  Carole E. Mah                Carole_Mah@xxxxxxxxx
              Senior Programmer/Analyst
    Brown University Scholarly Technology Group
                  phn 401-863-2669
                  fax 401-863-9313
              http://www.stg.brown.edu/
personal: http://www.stg.brown.edu/staff/carole.html



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.