[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Grouping and Sorting problem

Subject: Grouping and Sorting problem
From: Kuhns Matt <kuhns_m@xxxxxxxxx>
Date: Mon, 29 Jul 2002 12:14:26 -0700 (PDT)
grp 1 network
My XML Sheet looks like this:
<File>
<Script>
  <TestScript Name="Script1">
    <ScriptMessages>
      <SM ET="0" Grp="1">Script1 Error #1</SM>
      <SM ET="0" Grp="0">Script1 Error #0</SM>
      <SM ET="0" Grp="1">Script1 Error #1</SM>
      <SM ET="0" Grp="2">Script1 Error #2</SM>
      <SM ET="0" Grp="0">Script1 Error #0</SM>
      <SM ET="0" Grp="2">Script1 Error #2</SM>
      <SM ET="0" Grp="1">Script1 Error #1</SM>
      <SM ET="0" Grp="1">Script1 Error #1</SM>
      <SM ET="0" Grp="0">Script1 Error #0</SM>
      <SM ET="0" Grp="1">Script1 Error #1</SM>
      <SM ET="0" Grp="1">Script1 Error #1</SM>
    </ScriptMessages>
  </TestScript>
  <TestScript Name="Script2">
    <ScriptMessages>
      <SM ET="0" Grp="1">Script2 Error #1</SM>
      <SM ET="0" Grp="0">Script2 Error #0</SM>
      <SM ET="0" Grp="1">Script2 Error #1</SM>
      <SM ET="0" Grp="2">Script2 Error #2</SM>
      <SM ET="0" Grp="0">Script2 Error #0</SM>
      <SM ET="0" Grp="2">Script2 Error #2</SM>
      <SM ET="0" Grp="1">Script2 Error #1</SM>
      <SM ET="0" Grp="1">Script2 Error #1</SM>
      <SM ET="0" Grp="0">Script2 Error #0</SM>
      <SM ET="0" Grp="1">Script2 Error #1</SM>
      <SM ET="0" Grp="1">Script2 Error #1</SM>
    </ScriptMessages>
  </TestScript>
  <TestScript Name="Script3">
    <ScriptMessages>
      <SM ET="0" Grp="1">Script3 Error #1</SM>
      <SM ET="0" Grp="0">Script3 Error #0</SM>
      <SM ET="0" Grp="1">Script3 Error #1</SM>
      <SM ET="0" Grp="2">Script3 Error #2</SM>
      <SM ET="0" Grp="0">Script3 Error #0</SM>
      <SM ET="0" Grp="2">Script3 Error #2</SM>
      <SM ET="0" Grp="1">Script3 Error #1</SM>
      <SM ET="0" Grp="1">Script3 Error #1</SM>
      <SM ET="0" Grp="0">Script3 Error #0</SM>
      <SM ET="0" Grp="1">Script3 Error #1</SM>
      <SM ET="0" Grp="1">Script3 Error #1</SM>
    </ScriptMessages>
  </TestScript>
</Script>
</File>

My XSL Looks like this:

<xsl:key name="GroupDesc" match="SM" use="@Grp"/>

<xsl:for-each select="//Scripts//TestScript">
<xsl:variable name="NumScripts" select="position()"/>
<xsl:variable name="NumScriptMessages"
select="count(ScriptMessages/SM)"/> 
<xsl:value-of select="@Name"/> - <xsl:value-of
select="$NumScriptMessages"/> messages
  <br></br>

  <xsl:for-each
select="/File/Scripts/TestScript[$NumScripts]/ScriptMessages/SM[generate-id(.)=
         generate-id(key('GroupDesc', @Grp)[1])]">
    <xsl:sort select="@Grp"/>
    <xsl:variable name="MessageNum"
select="position()"/>
    <xsl:for-each select="key('GroupDesc', @Grp)">
      <xsl:value-of
select="format-number(number(@ET),'###,###,###,###')"/>
      <xsl:value-of select="current()"/>
      <br></br>
    </xsl:for-each>
  </xsl:for-each>
<br></br>
</xsl:for-each>

I left some parts of my XSL sheet off here like the
processing instructions, etc.
I want my results to be grouped my Scripts, then by
the Grp attribute, but I keep getting
All the messages under the first script.

Please Advise.
Thanks in advance

__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.