<table width="630"> {for $dvd at $counter in doc('dvd.xml')/dvdlist/dvd return <tr> <td valign="top"><img src="/dvd/images/{$dvd/imgSmall}" title="small cover"/></td> <td><table width="100%"><tr><td><a href="http://www.imdb.com/Title?{string($dvd/imdb_id)}" title="imdb">{string($dvd/@title)}</a></td><td align="right">{$counter}</td></tr> <tr><td><b>Director:</b></td><td>{string($dvd/director)}</td></tr> <tr rowspan="3"><td><b>Actors:</b></td><td> <table> {for $actor in ($dvd/cast/actor[1],$dvd/cast/actor[2],$dvd/cast/actor[3]) return <tr><td> {string($actor/@name)} as {string($actor/@role)} </td></tr> } {let $emptyTag := if (empty($dvd/cast/actor)) then doc('empty.xml')/tr else '' return $emptyTag} </table> </td></tr> <tr> <td colspan="2">{string($dvd/plot)}</td> </tr> </table> </td> </tr>} </table>