<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Qt 4.6: statisticsInHTML.xq Example File (xmlpatterns/qobjectxmlmodel/queries/statisticsInHTML.xq)</title> <link href="classic.css" rel="stylesheet" type="text/css" /> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td> <td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="functions.html"><font color="#004faf">All Functions</font></a> · <a href="overviews.html"><font color="#004faf">Overviews</font></a></td></tr></table><h1 class="title">statisticsInHTML.xq Example File<br /><span class="small-subtitle">xmlpatterns/qobjectxmlmodel/queries/statisticsInHTML.xq</span> </h1> <pre> <html> <head> <title></title> </head> <body> <p>In total the tree has {count($root//QObject)} QObject instances.</p> <p>Order by occurrence, the QObjects are:</p> <ol> { for $i in $root/preceding-sibling::metaObjects/metaObject let $count := count($root//QObject[@className eq $i/@className]) stable order by $count descending return if($count > 1) then <li>{string($i/@className), $count} occurrences</li> else () } </ol> <h1>Properties</h1> { (: For each QObject, we create a table listing : the properties of that object. :) for $object in $root//QObject return (<h2>{let $name := string($object/@objectName) return if(string-length($name)) then $name else "[no name]", '(', string($object/@className), ')'}</h2>, <table border="1"> <thead> <tr> <td>Property Name</td> <td>Value</td> </tr> </thead> <tbody> { $object/@*/<tr> <td> { name() } </td> <td> { if(data(.)) then string(.) else "N/A" } </td> </tr> } </tbody> </table>) } </body> </html></pre> <p /><address><hr /><div align="center"> <table width="100%" cellspacing="0" border="0"><tr class="address"> <td width="40%" align="left">Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies)</td> <td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td> <td width="40%" align="right"><div align="right">Qt 4.6.3</div></td> </tr></table></div></address></body> </html>