{-- transforms/testTrans.dtf#getDVDs --} define function noActor($title) { for $t in $title return <tr> <td>No actor specified for the movie {string($t)}</td> </tr> } for $dvdlist in $_dvdlistDoc return <table width="630"> {for $dvd in $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"> </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 noActor($dvd/@title) else '' return $emptyTag} </table> </td></tr> <tr> <td colspan="2">{string($dvd/plot)}</td> </tr> </table> </td> </tr>} </table>