XML/XQuery/last
Example of the last function
File: Data.xml
<orders>
<order name="B" xml:base="http://wbex.ru/ACC/">
<car id="0003" href="prod0003.html"/>
<car id="0002" href="prod0002.html"/>
</order>
<order name="A" xml:base="http://wbex.ru/WMN/">
<car id="0001" href="prod0001.html"/>
</order>
</orders>
File: Query.xquery
let $order := doc("Data.xml")/order
for $prod in $order/car
return concat($prod/id,
(if ($prod is $order/car[last()]) then (".") else (", ")))