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 (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + Use of before and after string (3) Sticky Topic
-> - How do I substitute element ty... (1)
-> + How does one add working days ... (4)
-> - Help, I have existing XLT and... (1)
-> + Need help on XSLT issue - (2)
-> + EDI to XML Conversion (7)
-> - XML To JSON Conversion using X... (1)
-> + Formatting Paragraphs to same ... (2)
-> - Grouping of records (1)
-> + Problems with xsd 1.1 (4)
-> + XML to HL7 mapping (3)
-> + XSLT 3 and Iterate (2)
-> + XSL-FO to PDF preview (3)
-> + java.lang.RuntimeException: Er... (2)
-> + Create Acroforms with Stylus X... (2)
-> + How to change XSLT parameter s... (3)
-> + how to change format of the da... (2)
-> + Search "Next 8 Results " doesn... (2)
-> - Support for Git (1)
-> + newbee (8)
-- [1-20] [21-40] [41-60] Next
+ XQuery Help and Discussion (2016)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
Dogmar SSubject: Combining Multiple Entries
Author: Dogmar S
Date: 15 Mar 2006 01:47 PM
Hello,

I am hoping that you can help me. I have the following output from my XSLT:


Name % Allocated Free Date Avg. Priority
-----------------------------------------------------------------------

#Dogmar Schenk 36 3/22/2006 2
#Stephan Grosse 20 3/24/2006 2
#Dogmar Schenk 40 3/29/2006 2
#Dogmar Schenk 3 4/1/2006 1

I want it to look like:

Name % Allocated Free Date Avg. Priority
-----------------------------------------------------------------------
#Stephan Grosse 20 3/24/2006 2
#Dogmar Schenk 79 3/29/2006 1.66

So that it combines the names and adds the % Allocated to create 1 line. The avg. priority would add the priorities for that line and divide by however many entries there are for the name.

My XSLT is:

<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
</head>
<body>
<table border="0">
<tr>
<th><font color="#CA226B">Name</font><hr /></th>
<th><font color="#CA226B">% Allocated</font><hr /></th>
<th><font color="#CA226B">Free Date</font><hr /></th>
<th><font color="#CA226B">Avg. Priority</font><hr /></th>
</tr> <xsl:for-each select="/Rows/Row">
<tr>
<xsl:choose>
<xsl:when test="Percent_x0020_Bandwidth*100 &lt; 90">
<td bgcolor="#00FF00">
<xsl:value-of select="substring(Assigned_x0020_To, 4,25)"/></td>
</xsl:when>
<xsl:when test="Percent_x0020_Bandwidth*100 &gt;= 90">
<td bgcolor="#FF0000">
<xsl:value-of select="substring(Assigned_x0020_To, 4,25)"/></td>
</xsl:when>
<xsl:otherwise>
<td><xsl:value-of select="substring(Assigned_x0020_To, 4,25)"/></td>
</xsl:otherwise>
</xsl:choose>
<td><center><xsl:value-of select="Percent_x0020_Bandwidth*100" /></center></td> <td><center><xsl:value-of select="Due_x0020_Date" /></center></td>
<td><center><xsl:value-of select="substring(Priority, 2,1)" /></center></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>


Please help me. I have spent 2 days woking on this and do not know where to go. Thank you very much.

DS

Postnext
(Deleted User) Subject: Combining Multiple Entries
Author: (Deleted User)
Date: 15 Mar 2006 02:13 PM
Hi, Dogmar. Try grouping on "substring(Assigned_x0020_To, 4,25)", as described in the following SSDN thread, and see if that works for you.

http://www.stylusstudio.com/SSDN/default.asp?action=9&read=4550&fid=48

Hope this helps.

David Foster
Stylus Studio Team

Postnext
Dogmar SSubject: Combining Multiple Entries
Author: Dogmar S
Date: 15 Mar 2006 02:42 PM
Thank you for the answer. There is a lot there to see and I am new for this, so I think I am getting a little confused. I only need the last part starting at:

<xsl:template match=mailbox" mode="group">

? or should I be looking someplace else?

By the way, my XML looks like:

<Rows>
<Row>
<_ListTitle>Team Projects</_ListTitle>
<_ListUrl>/sites/DevTeams/Team4/Lists/Team Projects/AllItems.aspx</_ListUrl>
<_SiteTitle>Team Serenity</_SiteTitle>
<_SiteUrl>http://sppserver/sites/DevTeams/Team4</_SiteUrl>
<_ItemId>1</_ItemId>
<_ItemUrl>/sites/DevTeams/Team4/Lists/Team Projects/DispForm.aspx?ID=1</_ItemUrl>
<_ItemEdit>/sites/DevTeams/Team4/Lists/Team Projects/EditForm.aspx?ID=1</_ItemEdit>
<Assigned_x0020_To>26;#Dogmar Schenk</Assigned_x0020_To>
<Percent_x0020_Bandwidth>0.36</Percent_x0020_Bandwidth>
<Due_x0020_Date>3/22/2006 12:00:00 AM</Due_x0020_Date>
<Priority>(2) Normal</Priority>
</Row>
<Row>
<_ListTitle>Team Projects</_ListTitle>
<_ListUrl>/sites/DevTeams/Team4/Lists/Team Projects/AllItems.aspx</_ListUrl>
<_SiteTitle>Team Serenity</_SiteTitle>
<_SiteUrl>http://sppserver/sites/DevTeams/Team4</_SiteUrl>
<_ItemId>2</_ItemId>
<_ItemUrl>/sites/DevTeams/Team4/Lists/Team Projects/DispForm.aspx?ID=2</_ItemUrl>
<_ItemEdit>/sites/DevTeams/Team4/Lists/Team Projects/EditForm.aspx?ID=2</_ItemEdit>
<Assigned_x0020_To>19;#Stephan Grosse</Assigned_x0020_To>
<Percent_x0020_Bandwidth>0.2</Percent_x0020_Bandwidth>
<Due_x0020_Date>3/24/2006 12:00:00 AM</Due_x0020_Date>
<Priority>(2) Normal</Priority>
</Row>
<Row>
<_ListTitle>Team Projects</_ListTitle>
<_ListUrl>/sites/DevTeams/Team4/Lists/Team Projects/AllItems.aspx</_ListUrl>
<_SiteTitle>Team Serenity</_SiteTitle>
<_SiteUrl>http://sppserver/sites/DevTeams/Team4</_SiteUrl>
<_ItemId>3</_ItemId>
<_ItemUrl>/sites/DevTeams/Team4/Lists/Team Projects/DispForm.aspx?ID=3</_ItemUrl>
<_ItemEdit>/sites/DevTeams/Team4/Lists/Team Projects/EditForm.aspx?ID=3</_ItemEdit>
<Assigned_x0020_To>26;#Dogmar Schenk</Assigned_x0020_To>
<Percent_x0020_Bandwidth>0.4</Percent_x0020_Bandwidth>
<Due_x0020_Date>3/29/2006 12:00:00 AM</Due_x0020_Date>
<Priority>(2) Normal</Priority>
</Row>
<Row>
<_ListTitle>Team Projects</_ListTitle>
<_ListUrl>/sites/DevTeams/Team4/Lists/Team Projects/AllItems.aspx</_ListUrl>
<_SiteTitle>Team Serenity</_SiteTitle>
<_SiteUrl>http://sppserver/sites/DevTeams/Team4</_SiteUrl>
<_ItemId>4</_ItemId>
<_ItemUrl>/sites/DevTeams/Team4/Lists/Team Projects/DispForm.aspx?ID=4</_ItemUrl>
<_ItemEdit>/sites/DevTeams/Team4/Lists/Team Projects/EditForm.aspx?ID=4</_ItemEdit>
<Assigned_x0020_To>26;#Dogmar Schenk</Assigned_x0020_To>
<Percent_x0020_Bandwidth>0.03</Percent_x0020_Bandwidth>
<Due_x0020_Date>4/1/2006 12:00:00 AM</Due_x0020_Date>
<Priority>(2) Normal</Priority>
</Row>

Thank you very much for your help.

DS

Postnext
Dogmar SSubject: Combining Multiple Entries
Author: Dogmar S
Date: 15 Mar 2006 04:37 PM
I am still workin on this, but it is not correct yet. Could you please look to see if I am doing something that I should not? Thank you very much.


Unknowntest(13).xml

Postnext
Minollo I.Subject: Combining Multiple Entries
Author: Minollo I.
Date: 15 Mar 2006 06:20 PM
Dogmar,
something like the attached XSLT should help.

Minollo


Documenttest(13).xsl
XSLT with grouping

Posttop
Dogmar SSubject: Combining Multiple Entries
Author: Dogmar S
Date: 16 Mar 2006 01:14 PM
Oh my. Thank you very much. It functions perfectly. I really can not thank you enough. Have a very good day!

DS

   
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.