Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


[xsl] Grouping & Counting Attribures

From: "Dick Penny" <d_penny@------->
To:
Date: 3/2/2009 11:10:00 PM
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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent