XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
xmlxmlxml xmlxmlxmlSubject: XSLT stylesheet to extract transmission times from the log.xml
Author: xmlxmlxml xmlxmlxml
Date: 06 Jun 2007 02:03 AM
Originally Posted: 05 Jun 2007 01:19 PM
I need to create an XSLT stylesheet to extract all transmission times from the log.xml file given below. The transmission times may be calculated from the timestamp and txstart attributes. any post-processing of the data is not to be done, so the XSLT stylesheet
needs to handle the calculations with XSL and XPath functions.
The same as above has to be done for the reception times.
Does anyone have any idea how to go about this?Pleezzzzzz.
log.dtd
<!ELEMENT entry EMPTY >
<!ELEMENT log (entry*) >
<!ATTLIST entry timestamp CDATA #REQUIRED >
<!ATTLIST entry type ( receive | transmit |
connect | disconnect |
unknown) #REQUIRED
>

<!-- The txstart element only exists if type == transmit
The attribute implies the starting time of the transmission
that ended with this event. -->
<!ATTLIST entry txstart CDATA #IMPLIED>

<!-- The rxstart element only exists if type == receive
The attribute implies the starting time of the transmission
that ended with this event. -->
<!ATTLIST entry rxstart CDATA #IMPLIED>

<!-- The nconns element exist if type == connect or type == disconnect
The attributes implies the number of connections currently upheld -->
<!ATTLIST entry nconns CDATA #IMPLIED>

excerpt of log.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE log SYSTEM "log.dtd">
<log>
<entry timestamp="1080735794.263077" type="unknown"/>
<entry timestamp="1080735794.263309" type="unknown"/>
<entry timestamp="1080735794.578490" type="transmit" txstart="1080735794.57849"/>
<entry timestamp="1080735794.578767" type="transmit" txstart="1080735794.51477"/>
<entry timestamp="1080735794.679855" type="unknown"/>
<entry timestamp="1080735794.680097" type="transmit" txstart="1080735794.3601"/>
<entry timestamp="1080735794.680371" type="transmit" txstart="1080735794.29637"/>
<entry timestamp="1080735795.401204" type="transmit" txstart="1080735794.7612"/>
<entry timestamp="1080735795.546366" type="transmit" txstart="1080735794.84237"/>
<entry timestamp="1080735795.705297" type="transmit" txstart="1080735794.9373"/>
<entry timestamp="1080735797.108384" type="receive" rxstart="1080735794.304842"/>
<entry timestamp="1080735797.108695" type="transmit" txstart="1080735796.5327"/>
....
</log>

Postnext
Elias HuterSubject: XSLT stylesheet to extract transmission times from the log.xml
Author: Elias Huter
Date: 06 Jun 2007 03:25 AM
I dont know in which format your timestamps are but it should be:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<frame>
<xsl:for-each select="log/entry[@*]">
<time>
<xsl:choose>
<xsl:when test="@timestamp and @txstart">
<xsl:value-of select="(number(@timestamp) - number(@txstart))div 1000"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>Data is missing, can't calculate</xsl:text>
</xsl:otherwise>
</xsl:choose>
</time>
</xsl:for-each>
</frame>
</xsl:template>
</xsl:stylesheet>

Posttop
xmlxmlxml xmlxmlxmlSubject: XSLT stylesheet to extract transmission times from the log.xml
Author: xmlxmlxml xmlxmlxml
Date: 07 Jun 2007 11:32 AM
Originally Posted: 07 Jun 2007 11:11 AM
Elias! Thank you so for your quick response.Could you possibly explain a bit further like why isn't the data there when we have the dtd to describe the xml's contents.Can't it be interspersed? Thanks.

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.