relpipe-data/examples-in-xmltable-ssm-gui.xml
branchv_0
changeset 271 a19312ab9db7
child 272 a756214f1ee8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/relpipe-data/examples-in-xmltable-ssm-gui.xml	Sun Oct 06 11:24:40 2019 +0200
@@ -0,0 +1,56 @@
+<stránka
+	xmlns="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/strana"
+	xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro">
+	
+	<nadpis>Generating statistics and charts using XMLTable</nadpis>
+	<perex>read a XML file and get a visual overview</perex>
+	<m:pořadí-příkladu>03100</m:pořadí-příkladu>
+
+	<text xmlns="http://www.w3.org/1999/xhtml">
+		
+		<p>
+			We are currently finalizing guidelines called <a href="https://sane-software.globalcode.info/">Sane software manifesto</a> 
+			(<a href="https://hg.globalcode.info/sane-software/sane-software-manifesto/">sources</a>).
+			This document consists of chapters and items. An item might be a requirement, a recommendation or an information.
+			In order to get a high-level overview, we generate statistics showing the counts of items of forementioned types in particular chapters.
+			Whole document is built using GNU Make, so we call also <m:name/> commands from the Makefile:
+		</p>
+		
+		<m:pre jazyk="makefile" src="examples/ssm-xmltable-1.makefile"/>
+
+		<p>
+			The first Makefile target stores relational data in the file <code>statistics.rp</code> (which is re/generated only if <code>ssm.en.xml</code> has been changed).
+			And then this file is used twice: for terminal output using <code>relpipe-out-tabular</code> and for visual output with a chart using <code>relpipe-out-gui</code>.
+		</p>
+		
+		<p>
+			The <code>relpipe-in-xmltable</code> simply counts items (requirements, recommendations, informations, totals) in each chapter using XPath expressions.
+			So we can see how <em>heavy</em> and strict particular chapters are:
+		</p>
+		
+		<m:pre jazyk="text" src="examples/ssm-xmltable-1.txt"/>
+		
+		
+		<p>
+			However – for such data – much better than a table is a chart.
+			So we pipe the raw relational data prepared in the <code>build/statistics.rp</code> to the <code>relpipe-out-gui</code> command.
+			But because this tool counts totals itself and stacks the values in the bar chart,
+			we remove the <code>items_total</code> attribute from the relation using <code>relpipe-tr-cut</code> transformation.
+			Thanks to regular expressions, it is very concise. But of course, we can make it more explicit:
+		</p>
+		
+		<m:pre jazyk="bash"><![CDATA[relpipe-tr-cut "chapter" "(name|requirements|recommendations|informations)"
+# relation name ^          ^ attribute names to be passed through (others are filtered out)]]></m:pre>
+		
+		<p>We also set the window title (using the <code>-title</code> Qt option) and get the chart:</p>
+		
+		<m:img src="img/sane-software-statistics-chart-1.png"/>
+		
+		<p>
+			
+		</p>
+
+		
+	</text>
+
+</stránka>
\ No newline at end of file