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)
-> + Learning XML/XSLT (2)
-> + XSL Help Please. (11)
-> + Calling javascript in xslt wit... (2)
-> + StylusStudio XSLT Debugging (2)
-> + Assigning a variable (3)
-> + How do I deploy my .xsl file t... (7)
-> + XSLT help - newbie (9)
-> + xsl:key, scope and creating of... (6)
-> + Help for preceding-sibling in ... (5)
-> + WYSIWYG with XSLT 2.0 (4)
-> + Best way to generate PDF using... (4)
-> + Href and display linked number... (7)
-> + XmlWriter and output to a brow... (3)
-> - group by min value (5)
-> ->group by min value
-> ->group by min value
-> ->group by min value
-> ->group by min value
-> + Generating unique ID in whole ... (6)
-> + XSL - find and replace?? Newb... (2)
-> + Adding Tag to embed childs bel... (2)
-> + xsl:strip-space (2)
-> + Creating duplicated KEY (2)
-> + Displaying xml document in HTM... (4)
-- Previous [1261-1280] [1281-1300] [1301-1320] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
giancarlo rossiSubject: group by min value
Author: giancarlo rossi
Date: 30 Oct 2006 10:03 AM
I dont understand becouse thes xsl not is able to group by min...

It doesnt display the min value of <supplier>po2</supplier>

see the attachement.
Thanks in advance.


Unknownitem.xsl


Unknownitem(1).xml

Postnext
Ivan PedruzziSubject: group by min value
Author: Ivan Pedruzzi
Date: 30 Oct 2006 10:49 PM

Because the loop is sorted ascending you need to consider only the first iteration.

Hope this helps
Ivan Pedruzzi
Stylus Studio Team


<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="GROUP" match="item" use="supplier"/>
<xsl:template match="/">
<xsl:for-each select="root/item[generate-id(.)=generate-id(key('GROUP',supplier))]">
<xsl:sort select="totale_finale" data-type="number" order="ascending"/>
<xsl:if test="position() = 1">
<xsl:value-of select="concat(supplier,' ', totale_finale) "/>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

Postnext
giancarlo rossiSubject: group by min value
Author: giancarlo rossi
Date: 31 Oct 2006 04:04 AM
Originally Posted: 31 Oct 2006 04:02 AM
HI Ivan,

In this case I get only one item

and the response is "po2 110"

not "po2 90"


further the results should be like this one:

pos2 90

pos3 222

pos1 2345


group by min and supplier...

Thanks in advance
Giancarlo.

Postnext
Ivan PedruzziSubject: group by min value
Author: Ivan Pedruzzi
Date: 31 Oct 2006 06:03 PM

Sorry Giancarlo I misunderstood you

The following does what you have described

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="GROUP" match="item" use="supplier"/>
<xsl:template match="/">
<xsl:for-each select="root/item[generate-id(.)=generate-id(key('GROUP',supplier))]">
<xsl:for-each select="key('GROUP',supplier)">
<xsl:sort select="totale_finale" data-type="number" order="ascending"/>
<xsl:if test="position() = 1">
<xsl:value-of select="concat(supplier,' ', totale_finale, '&#xA;') "/>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

Posttop
giancarlo rossiSubject: group by min value
Author: giancarlo rossi
Date: 05 Nov 2006 04:47 AM
sorry for the delay...

just a little sort modification

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="GROUP" match="item" use="supplier"/>
<xsl:template match="/">
<xsl:for-each select="root/item[generate-id(.)=generate-id(key('GROUP',supplier))]">
<xsl:sort select="totale_finale" data-type="number" order="ascending"/>
<xsl:for-each select="key('GROUP',supplier)">
<xsl:if test="position() = 1">
<xsl:value-of select="concat(supplier,' ', totale_finale, '&#xA;') "/>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

Thanks a lot.
G.

   
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.