There are many computers in an IT inventory. Each one has a name and textual properties with limited possible values (OS version, disk type,...).
The Data Worker is an HTTP server which receives properties from each computer and generates dashboards for the IT manager. There is a dashboard for each property. A dashboard is rendered as an HTML table where computer names are grouped per values for the corresponding property. While, for example, migrating for one OS version to another, the OS dashboard explicitly lists which computers are still to be migrated.
declare namespace output="http://www.w3.org/2010/xslt-xquery-serialization"; declare option output:indent "yes"; processing-instruction xml-stylesheet {'href="xsl/xsltforms.xsl" type="text/xsl"'}, let $doc := fn:doc('../private/inventory.xml')/inventory let $m := $doc/computers/computer let $nicm := map { for $n in $doc/nics/nic return entry {fn:data($n/@idref-to-nic-owner)} {fn:data($n/timestamp)} } let $m2 := ( for $s in $m order by $s/name return $s ) let $totalPC := fn:count($m) return <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms"> <head> <title>Répartition Postes</title> <style> body {{ font-family: arial,sans-serif; font-size: 80%; }} table {{ border-collapse: collapse; }} table, th, td {{ border: 1px solid black; }} </style> <xf:model> <xf:instance> <inventory xmlns="" total="{$totalPC}" selected="version">{ ('version', 'architecture', 'model', 'disktype', 'office') ! <group name="{.}"> { let $n := . for $s in $m2 group by $v := (if ($s/*[name() eq $n]) then $s/*[name() eq $n] else ' ') order by $v return <item name="{if ($v eq ' ') then 'unknown' else $v}" total="{fn:count($s)}">{ $s ! name ! xs:string(.) }</item> } </group> }</inventory> </xf:instance> </xf:model> </head> <body> <p>{ fn:format-dateTime(file:last-modified('../private/inventory.xml'), '[h01]:[m01]:[s01] [D]/[M]/[Y,2-2]') || ' - ' || $totalPC || ' ordinateurs dans l''inventaire' }</p> <xf:select1 ref="@selected"> <xf:itemset ref="../group"> <xf:label ref="@name"/> <xf:value ref="@name"/> </xf:itemset> </xf:select1> <table> <tbody> <xf:repeat ref="group[@name = /inventory/@selected]/item"> <tr> <td><xf:output value="if(@name = 'unknown', 'inconnu', @name)"/></td> <td><xf:output value="@total"/></td> <td><xf:output value="."/></td> </tr> </xf:repeat> </tbody> </table> </body> </html>