|
Subject: [xsl] Grouping & Counting Attribures From: "Dick Penny" <d_penny@xxxxxxx> Date: Mon, 02 Mar 2009 15:09:35 -0800 |
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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] XSLT test condition, David Carlisle | Thread | Re: [xsl] Grouping & Counting Attri, David Carlisle |
| Re: [xsl] XSLT test condition, David Carlisle | Date | Re: [xsl] XSLT test condition, Senthilukvelaan |
| Month |