On Wed, Oct 01, 2003 at 09:49:26PM +0200, Vaclav Barta wrote: > Hi, > > I have a form producing quite a few parameters (a1, b1, t1, a2, b2, t2 ... a5, > b5, t5), and another page which basically just displays the values from the > first page. This second page uses XSP, and my custom taglib handles each > parameter triple (i.e. a1, b1, t1) by markup like > > <eq> > <numbers:added> > <numbers:num1><param:a1/></numbers:num1> > <numbers:num2><param:b1/></numbers:num2> > <numbers:sum><param:t1/></numbers:sum> > </numbers:added> > </eq> > > (which is later transformed into a table row). It works, but the same markup > (actually about 3 times longer than the example above) must be repeated 5 > times, which is awful. Is there a way to compute the parameter names, IOW can > I specify my markup just once and then call the template with 1, 2 ... 5?
Use Robin's AttrParam taglib, it lets you specify the param name in an attribute, or subtag. Using a subtag, something like this is possible: <eq> <numbers:added> <xsp:logic> for my $i (1..5) { <xsp:element> <xsp:name>num<xsp:expr>$i</xsp:expr></xsp:name> <aprm:param><aprm:name><xsp:expr>chr(64+$i)</xsp:expr>1</aprm:name></aprm:param> </xsp:element> } </xsp:logic> </numbers:added> </eq> There's one drawback, however: <xsp:element> is, as far as I know, not yet able to create namespaced elements. But a following XSLT stylesheet can easily fix that. If that example still looks lengthy, then wait for the next release of axkit, we are currently devising a system that will shorten the above example significantly. -- CU Joerg PGP Public Key at http://ich.bin.kein.hoschi.de/~trouble/public_key.asc PGP Key fingerprint = D34F 57C4 99D8 8F16 E16E 7779 CDDC 41A4 4C48 6F94 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]