Subject: Re: [xsl] mod position() tests positive all of the time From: Abel Braaksma <abel.online@xxxxxxxxx> Date: Sat, 30 Dec 2006 14:57:49 +0100 |
Why did you choose to use call-template? Using apply-template and template matches is likely much easier.
<xsl:template name="results">What this does highly depends on your input. For instance, if you have a set of "object" nodes, and each has one "thumbnail" node, then this for-each will select all of them (as postion() is always for each first thumbnail node under object). Depending on your input, you may want to write this a little different for readability, but as far as I can tell, this code is not wrong per se.
<table>
<xsl:for-each
select="insightResponse/searchResponse/collectionResultSet/object/thumbnail[position()
mod 5 = 1]">
Input file: <input> <thumbnail url="http://someurl/bla1.gif" /> <thumbnail url="http://someurl/bla2.gif" /> <thumbnail url="http://someurl/bla3.gif" /> <thumbnail url="http://someurl/bla4.gif" /> <thumbnail url="http://someurl/bla5.gif" /> <thumbnail url="http://someurl/bla6.gif" /> <thumbnail url="http://someurl/bla7.gif" /> <thumbnail url="http://someurl/bla8.gif" /> <thumbnail url="http://someurl/bla9.gif" /> <thumbnail url="http://someurl/bla10.gif" /> <thumbnail url="http://someurl/bla11.gif" /> <thumbnail url="http://someurl/bla12.gif" /> <thumbnail url="http://someurl/bla13.gif" /> <thumbnail url="http://someurl/bla14.gif" /> </input>
Output after transformation: <html> <body> <table> <tr> <td><img src="http://someurl/bla1.gif"/></td> <td><img src="http://someurl/bla2.gif"/></td> <td><img src="http://someurl/bla3.gif"/></td> <td><img src="http://someurl/bla4.gif"/></td> <td><img src="http://someurl/bla5.gif"/></td> </tr> <tr> <td><img src="http://someurl/bla6.gif"/></td>* * <td><img src="http://someurl/bla7.gif"/></td> <td><img src="http://someurl/bla8.gif"/></td> [.....] etc.
Cheers, -- Abel Braaksma http://www.nuntia.nl
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] mod position() tests posi, Abel Braaksma | Thread | Re: [xsl] mod position() tests posi, Tony Graham |
Re: [xsl] mod position() tests posi, Tony Graham | Date | Re: [xsl] mod position() tests posi, Allen Jones |
Month |