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

Grouping & Counting Attribures

Subject: Grouping & Counting Attribures
From: "Dick Penny" <d_penny@xxxxxxx>
Date: Mon, 02 Mar 2009 15:09:35 -0800
 Grouping & Counting Attribures
The newbie is back at the fountain of knowledge - I thought I had this,
first part was too easy, but......

Maybe I'm learning how to post hereto. My data looks like:

<dsQueryResponse>
     <Rows>
       <Row AuditName="Cashbox II" State="ActionPlan" category="a" />
       <Row AuditName="SNP" State="ActionPlan" category="a" />
       <Row AuditName="Cashbox II" State="InReview" category="a" />
       <Row AuditName="SNP" State="ActionPlan" category="b" />
     </Rows>
  </dsQueryResponse>

My current xslt follows with ### indicating experimental lines that do not
work, and ??? indicating questions on specific lines.

<xsl:key name="audits" match="Row" use="@AuditName" />
<xsl:template match="/dsQueryResponse/Rows">
  <table>
    <tr><th>AUDIT</th><th># Rows</th>
    	<th># ActionPlan</th><th># InReview</th>
    	<th># FollowUp</th><th># Closed</th>
    </tr>
    <xsl:apply-templates
      select="*[@AuditName and
                generate-id(.)=generate-id(key('audits', @AuditName))]" />
??? why didn't this need a [1] near end to get first occurance ???
  </table>
</xsl:template>

<xsl:template match="*[@AuditName]">
  <xsl:variable name="findings" select=key('audits', @AuditName)/>
 intention was to get sub-set of rows for 1 audit into a variable
  <tr>
    <td><xsl:value-of select="@AuditName" /></td>
    <td><xsl:value-of select="count(key('audits', @AuditName))" /></td>
### this works ###
    <td><xsl:value-of select="count($findings[@State='ActionPlan'])" /></td>
### above line does not work, was meant to go with  above. ###
    <td><xsl:value-of select="count(key('audits', @State['InReview']))"
/></td>
### this states what I am trying to do, but I know syntax is wrong ###
### cannot select on the 2D list returned by key ###
      </tr>
</xsl:template>


Output would be like:

Audit  # Rows  ActionPlan  InReview ..........
CashboxII 2      1           1
SPN       2      2           0

Dick Penny

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.