xsl-list
[Top] [All Lists]

[xsl] Grouping & Counting Attribures

2009-03-02 18:10:08
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="*[(_at_)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="*[(_at_)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[(_at_)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




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>