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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1144)
+ Stylus Studio Technical Forum (14123)
+ Website Feedback (244)
- XSLT Help and Discussion (7506)
-> + Hi without hard code filed na... (2)
-> + XSLT output does not work (2)
-> + How can I do this javascript i... (2)
-> + Paging with XSL and passing UR... (2)
-> + XPath Condition Query (3)
-> + Xalan Multiple XML Output Over... (3)
-> + Inserting Line Break (2)
-> + Get Value from non-standard xm... (2)
-> + Root node renaming and adding ... (2)
-> + Cannot get CDATA to render pro... (2)
-> - How to add a footer on reports... (1)
-> - Apply-templates and processing... (1)
-> + Help Please - Use data from no... (5)
-> - Behaviour of trace function (1)
-> + How to Build a Dynamic XPath E... (3)
-> - raw xml to generic xml (1)
-> - Merging two documents (1)
-> + XSLT Path help (3)
-> + how to sort, dates in xsl ? (3)
-> + Naming elements (3)
-> + XSL IF Statement (2)
-> + XSLT Help Needed (4)
-> + Character Increment (4)
-> - concat function not working wi... (1)
-> + XSLT only namespace attribute ... (2)
-> - using uri within RSS enclosure... (1)
-> + Transforming Data With XSLT (3)
-> + Validate XPath on variable (8)
-> - flatten xml structure then sor... (1)
-> + SYNTAX not working (2)
-> + Looping through xml document (3)
-> + can i modify the xml data in X... (2)
-> + can i modify the xml data in X... (2)
-> + regex (2)
-> + xslt document and web services... (2)
-> + looping question (2)
-> + XML to Excel Conversion using ... (4)
-> + Compare (2)
-> + problem in loadxml function (2)
-> + does IE support script in xsl (2)
-> + converting Time format (2)
-> + Single Message split into Mult... (5)
-> + xml template design (2)
-> + String to array (2)
-> + Page Break with XSL-FO (4)
-> + Need help Translating string (2)
-> + Transforming input xml paramet... (3)
-> + How to transform node from inc... (2)
-> + XSL:FO Marker Question (2)
-> + trim after character...? (2)
-> + Convernting CSS + xsl to XSL:F... (2)
-> + save external image in xml/xsl (3)
-> + Table of Contents (2)
-> + Problem with select expression (2)
-> + Slow for-each select (7)
-> + Restructuring XML (2)
-> + Coloring xml output (3)
-> + Looping through xsl based on a... (5)
-> + Where is the wizard? (3)
-> + Save XML thru href (2)
-> + existing xslt, source and dest... (5)
-> + spliting xml files by certain ... (8)
-> + checking condition and writing... (2)
-> + how to insert un return in the... (2)
-> + String in a range (5)
-> + To identify the right edition (4)
-> + Flow Control Feature (2)
-> + calling nested external functi... (3)
-> + Replacing commas with a blank (6)
-> + Grouping very urgent . (2)
-> + xsl node number (3)
-> + Wordml intelligence (6)
-> + Preview and backmapping for wo... (5)
-> + XSLT - find line numbers of di... (2)
-> + The last five bytes of a varia... (7)
-> + simple problem but i'm a bit t... (3)
-> + H plz help me (2)
-> + XSLT : Very Urgent Requirement (7)
-> + comparing two xml files (3)
-> + Support for xsl created from w... (4)
-> + Wildcard Param (3)
-> + XSLT OutOfMemoryError (3)
-> + How can I output the filename ... (7)
-> + How do I strip out a comma ast... (8)
-> + xslt current-dateTime() not re... (2)
-> + Exceed the maximum recursion d... (8)
-> + Saxon9 "java.net.ConnectExcept... (2)
-> - Help Required (1)
-> + XSLT Help to get value from Up... (2)
-> + Date Functions (5)
-> + Need to unescape < and > (2)
-> + No Topic (2)
-> + Problem with handling multiple... (3)
-> + Question XPath expression (dis... (2)
-> + New user, basic question (2)
-> + Serializing XML to a string wi... (2)
-> + Node already has a control li... (2)
-> + Trying to access the position ... (5)
-> + XSLT Help (2)
-> + XSLT, Microsoft Access, and re... (4)
-- Previous [481-500] [501-520] [521-540] Next
+ XQuery Help and Discussion (1890)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (361)
+ Stylus Studio Announcements (113)
Topic  
Postnext
Nad ineSubject: Help : Display Tabular Data (with no repetitive data)
Author: Nad ine
Date: 23 Jan 2005 09:49 PM
I have an xml document like below-->

<?xml version="1.0" encoding="ISO8859-1" ?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<Attempts>
<Attempt StartTime="20041018 082300" DocSerialNum="A10374283" EndTime="20041018 082601">
<Screen Id="1" StartTime="082300" KeysPressed="Left3" />
<Screen Id="38" StartTime="082300" KeysPressed="Left2" />
<Screen Id="2" StartTime="082302" KeysPressed="Left3" />
<Screen Id="3" StartTime="082311" KeysPressed="Left3" />
<Screen Id="44" StartTime="082317" KeysPressed="0" />
<Screen Id="44" StartTime="082436" KeysPressed="1" />
<Screen Id="44" StartTime="082436" KeysPressed="6" />
<Screen Id="44" StartTime="082437" KeysPressed="2" />
<Screen Id="44" StartTime="082438" KeysPressed="2" />
<Screen Id="44" StartTime="082439" KeysPressed="1" />
<Screen Id="44" StartTime="082440" KeysPressed="8" />
<Screen Id="44" StartTime="082441" KeysPressed="7" />
<Screen Id="44" StartTime="082442" KeysPressed="3" />
<Screen Id="44" StartTime="082443" KeysPressed="5" />
<Screen Id="44" StartTime="082444" KeysPressed="Left2" />
<Screen Id="45" StartTime="082446" KeysPressed="Left3" />
<Screen Id="21" StartTime="082510" KeysPressed="Left2">
<Data Label="Print Error" Value="MethodTag: 5" />
<Data Label="BNA CancelOperation" Value="Request ID =5" />
</Screen>
</Attempt>
<Attempt StartTime="20041019 092300" DocSerialNum="A10374283" EndTime="20041019 102601">
<Screen Id="1" StartTime="082300" KeysPressed="Left3" />
<Screen Id="38" StartTime="082300" KeysPressed="Left2" />
<Screen Id="2" StartTime="082302" KeysPressed="Left3" />
<Screen Id="3" StartTime="082311" KeysPressed="Left3" />
<Screen Id="44" StartTime="082317" KeysPressed="0" />
<Screen Id="44" StartTime="082436" KeysPressed="1" />
<Screen Id="44" StartTime="082436" KeysPressed="6" />
<Screen Id="44" StartTime="082437" KeysPressed="2" />
<Screen Id="44" StartTime="082438" KeysPressed="2" />
<Screen Id="44" StartTime="082439" KeysPressed="1" />
<Screen Id="44" StartTime="082440" KeysPressed="8" />
<Screen Id="44" StartTime="082441" KeysPressed="7" />
<Screen Id="44" StartTime="082442" KeysPressed="3" />
<Screen Id="44" StartTime="082443" KeysPressed="5" />
<Screen Id="44" StartTime="082444" KeysPressed="Left2" />
<Screen Id="45" StartTime="082446" KeysPressed="Left3" />
<Screen Id="21" StartTime="082510" KeysPressed="Left2">
<Data Label="Print Pass" Value="MethodTag: 8" />
<Data Label="Completed" Value="Request ID =3" />
</Screen>
</Attempt>
<Attempt StartTime="20041020 102300" DocSerialNum="A44374283" EndTime="20041020 112601">
<Screen Id="1" StartTime="082300" KeysPressed="Left3" />
<Screen Id="38" StartTime="082300" KeysPressed="Left2" />
<Screen Id="2" StartTime="082302" KeysPressed="Left3" />
<Screen Id="3" StartTime="082311" KeysPressed="Left3" />
<Screen Id="44" StartTime="082317" KeysPressed="0" />
<Screen Id="44" StartTime="082436" KeysPressed="1" />
<Screen Id="44" StartTime="082436" KeysPressed="6" />
<Screen Id="44" StartTime="082437" KeysPressed="2" />
<Screen Id="44" StartTime="082438" KeysPressed="2" />
<Screen Id="44" StartTime="082439" KeysPressed="1" />
<Screen Id="44" StartTime="082440" KeysPressed="8" />
<Screen Id="44" StartTime="082441" KeysPressed="7" />
<Screen Id="44" StartTime="082442" KeysPressed="3" />
<Screen Id="44" StartTime="082443" KeysPressed="5" />
<Screen Id="44" StartTime="082444" KeysPressed="Left2" />
<Screen Id="45" StartTime="082446" KeysPressed="Left3" />
<Screen Id="21" StartTime="082510" KeysPressed="Left2">
<Data Label="Print Pass" Value="MethodTag: 8" />
<Data Label="Completed" Value="Request ID =3" />
</Screen>
</Attempt>
</Attempts>


I have tried to convert them to html table by using xsl. I am able to display those data
but there is a repetition data in the display HTML table. I want to display one single data only in a row,
by mean that i want to display the data based on DocSerialNum. Please guide me to do this.
Really appreciate your help.

Below is the created xsl document -->

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" />
<xsl:template match="/">
<style type="text/css">
BODY {
MARGIN: 0px; PADDING-BOTTOM: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px FONT-SIZE: 10px
}


TABLE {
FONT-FAMILY: "Verdana", "Geneva", "Arial", "Sans-Serif"; FONT-SIZE: 10px
}
TR {
FONT-FAMILY: "Verdana", "Geneva", "Arial", "Sans-Serif"; FONT-SIZE: 10px
}
TD {
FONT-FAMILY: "Verdana", "Geneva", "Arial", "Sans-Serif"; FONT-SIZE: 10px
}
DIV {
FONT-FAMILY: "Verdana", "Geneva", "Arial", "Sans-Serif"; FONT-SIZE: 10px
}

</style>


<table border="1">
<tr>
<th align="middle">Date dd/mm/yyyy</th>
<th align="middle">Start Time hh:mm:ss</th>
<th align="middle">End time hh:mm:ss</th>
<th align="middle">Doc Serial Number No</th>
<th align="middle">Interval (minutes)</th>
<th align="middle">Error Encountered</th>
</tr>
<xsl:for-each select="Attempts/Attempt">
<xsl:variable name="errorName" select="(@Label)"/>
<xsl:variable name="temp2" select="0" />
<xsl:variable name="date" select="substring(@StartTime,1,15)"/>
<xsl:variable name="date2" select="substring(@EndTime,1,15)"/>


<tr>

<!-- to diplay starttime-->
<td><xsl:value-of select="concat(substring($date, 7,2),'/',substring($date, 5, 2),'/',substring($date, 1,4))"/></td>
<td align="left"><xsl:value-of select="concat(substring($date,10,2),':',substring($date,12,2),':',substring($date,14,2))"/></td>

<!-- to diplay endtime-->
<td align="left"><xsl:value-of select="concat(substring($date2,10,2),':',substring($date2,12,2),':',substring($date2,14,2))"/></td>

<!-- to diplay Document No-->
<!-- <td><xsl:value-of select="not(@DocSerialNum)"/></td>-->
<td>
<xsl:choose>
<xsl:when test="substring(@DocSerialNum,1,9)">
<xsl:value-of select="substring(@DocSerialNum,1,9)"/>

</xsl:when>
<xsl:otherwise>
<xsl:text>-</xsl:text>
</xsl:otherwise>
</xsl:choose>
</td>

<!-- to diplay interval time-->
<td align="left"><xsl:value-of select="round(substring(@EndTime,10,6) div 60 - substring(@StartTime,10,6) div 60)"/></td>


<!-- to diplay error *testing-->
<td>
<xsl:choose>
<xsl:when test="Screen/Data[@Label = 'Print Error']">
<xsl:value-of select="$errorName"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>no error</xsl:text>
</xsl:otherwise>
</xsl:choose>
</td>

</tr>
</xsl:for-each>
</table>
Report finish......
</xsl:template>
</xsl:stylesheet>

Postnext
Ivan PedruzziSubject: Help : Display Tabular Data (with no repetitive data)
Author: Ivan Pedruzzi
Date: 25 Jan 2005 12:24 AM

Add the following key definition

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

<!-- create a map with all the DocSerialNum values -->
<xsl:key name="DocSerialNum_To_Attemp_Map" match="Attempts/Attempt" use="@DocSerialNum"/>


...

then change the for-each condition

<xsl:for-each select="Attempts/Attempt[generate-id() = generate-id(key('DocSerialNum_To_Attemp_Map, @DocSerialNum)[1])]">


Hope this helps
Ivan

Postnext
Nad ineSubject: Help : Display Tabular Data (with no repetitive data)
Author: Nad ine
Date: 25 Jan 2005 09:25 PM
Thank you Ivan for the answer.
I've tried to apply to my existing xsl document like at the bottom of this.
But unluckly, my xml document unable to load and receive error of
"A string literal was not closed. Attempts/Attempt[generate-id() = generate-id(key(-->'DocSerialNum_To_Attemp_Map, @DocSeri..."
I'm not pretty sure about the way i put the key statement.
Please help me, i'm a newbie in this xml and xsl world.
Appreciate any help or suggestion which could guide me to be better.
Thank you in advanced.


<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" />
<xsl:key name="DocSerialNum_To_Attemp_Map" match="Attempts/Attempt" use="@DocSerialNum"/>
<xsl:template match="/">
<style type="text/css">
BODY {
MARGIN: 0px; PADDING-BOTTOM: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px FONT-SIZE: 10px
}

TABLE {
FONT-FAMILY: "Verdana", "Geneva", "Arial", "Sans-Serif"; FONT-SIZE: 10px
}
TR {
FONT-FAMILY: "Verdana", "Geneva", "Arial", "Sans-Serif"; FONT-SIZE: 10px
}
TD {
FONT-FAMILY: "Verdana", "Geneva", "Arial", "Sans-Serif"; FONT-SIZE: 10px
}
DIV {
FONT-FAMILY: "Verdana", "Geneva", "Arial", "Sans-Serif"; FONT-SIZE: 10px
}

</style>


<table border="1">
<tr>
<th align="middle">Date dd/mm/yyyy</th>
<th align="middle">Start Time hh:mm:ss</th>
<th align="middle">End time hh:mm:ss</th>
<th align="middle">Doc Serial Number No</th>
<th align="middle">Interval (minutes)</th>
<th align="middle">Error Encountered</th>
</tr>

<!-- create a map with all the DocSerialNum values -->
<xsl:for-each select="Attempts/Attempt[generate-id() = generate-id(key('DocSerialNum_To_Attemp_Map, @DocSerialNum)[1])]">

<xsl:variable name="errorName" select="(@Label)"/>
<xsl:variable name="temp2" select="0" />
<xsl:variable name="date" select="substring(@StartTime,1,15)"/>
<xsl:variable name="date2" select="substring(@EndTime,1,15)"/>


<tr>
<!-- to diplay starttime-->
<td><xsl:value-of select="concat(substring($date, 7,2),'/',substring($date, 5, 2),'/',substring($date, 1,4))"/></td>
<td align="left"><xsl:value-of select="concat(substring($date,10,2),':',substring($date,12,2),':',substring($date,14,2))"/></td>

<!-- to diplay endtime-->
<td align="left"><xsl:value-of select="concat(substring($date2,10,2),':',substring($date2,12,2),':',substring($date2,14,2))"/></td>

<!-- to diplay Document No-->
<td>
<xsl:choose>
<xsl:when test="substring(@DocSerialNum,1,9)">
<xsl:value-of select="substring(@DocSerialNum,1,9)"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>-</xsl:text>
</xsl:otherwise>
</xsl:choose>
</td>

<!-- to diplay interval time-->
<td align="left"><xsl:value-of select="round(substring(@EndTime,10,6) div 60 - substring(@StartTime,10,6) div 60)"/></td>

<!-- to diplay error *testing-->
<td>
<xsl:choose>
<xsl:when test="Screen/Data[@Label = 'Print Error']">
<xsl:value-of select="$errorName"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>no error</xsl:text>
</xsl:otherwise>
</xsl:choose>
</td>

</tr>
</xsl:for-each>
</table>
Report finish......
</xsl:template>
</xsl:stylesheet>

Postnext
Ivan PedruzziSubject: Help : Display Tabular Data (with no repetitive data)
Author: Ivan Pedruzzi
Date: 25 Jan 2005 10:51 PM

Just a missing '

<xsl:for-each select="Attempts/Attempt[generate-id() = generate-id(key('DocSerialNum_To_Attemp_Map', @DocSerialNum)[1])]">

Posttop
Nad ineSubject: Help : Display Tabular Data (with no repetitive data)
Author: Nad ine
Date: 26 Jan 2005 04:33 AM
Owh..it's working now!

Thanks a lot Ivan.

   
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-2011 All Rights Reserved.