Altova Mailing List Archives


RE: [xsl] XSL to analyse some XML log files

From: "Michael Kay" <mike@------------>
To:
Date: 12/4/2005 9:07:00 AM
> I would like to do the following and hope that you can help me:
> 
> 1) Generate another XML file that does not contain logs 
> (<log> tag defines a
> log) that belong to the test mode (<change> tag with value 
> "mode TEST").
> That means all log files between the test mode and any other mode.

<xsl:copy-of select="log[not(change='TEST' or (not(change) and
(preceding-sibling::log/change)[last()]='TEST')))]"/>
> 
> 2) Generate one XML file for each mode, one for "mode TEST", 
> one of "mode
> A", one for "mode B") with all the logs that belong to each 
> mode. That means
> e.g. that all the logs after <change>mode B</change> are 
> stored into the
> "mode B" file, equeally for the others.

This is a classic grouping problem (www.jenitennison.com/xslt/grouping) in
which the grouping key is the most recent CHANGE element, calculated as
above. In XSLT 2.0

<xsl:for-each-group select="log"
group-by="((.|preceding-sibling::log)/change)[last()]"/>

> 
> 3) Calcuate the time difference in seconds (<time> value is 
> also provide in
> seconds) between the <useraction>Start</useraction> and the
> <useraction>Stop</useraction> of the "mode A".
> 
I'll pass on that one, got to be off to Mass.

Michael Kay
http://www.saxonica.com/

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.