|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] for-each sort of thing in {} ?
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}&id2={bar[position()=2]/@id}&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 = "&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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








