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

Simple Metrics Can't see how to do a pattern

Subject: Simple Metrics Can't see how to do a pattern
From: Arthur Maloney <ArthurM@xxxxxxxxxx>
Date: Thu, 12 Jun 2008 06:34:52 +0100
 Simple Metrics Can't see how to do a pattern
Hello Xsl-list,

I'm using Xslt v1 and doing a transform to Xhtml with .net

output shard
<tr>
           <th>Amex</th>
           <th>MasterCard</th>
           <th>Visa</th>
</tr>
<tr>
           <th>1</th>
           <th>13</th>  (e.g. 9+4)
           <th>7</th>
</tr>

Just focusing on MasterCard.
<xsl:variable name="totalMasterCard"
select="sum(/leaderBoard/Table1/countType[parent::node()/productType[='Master
Card'])"/>

I'm trying to sum "countType" for Table1 elements where
productCategory=MasterCard.
Its not parsing.
What's the correct grammar for this?
I think of it as: Find all parent nodes of node where productType=MasterCard.
Sum "countType" nodes of parent node.

If "countType" GT 0 there will always be a "productType" sibling above it.

Xml shard

<leaderBoard>
       ...
  <Table1>
    <productCategory>CreditCard</productCategory>
    <productType>Amex</productType>
    <countType>1</countType>
    <countLeadSource>1</countLeadSource>
    <countRadioStation>1</countRadioStation>
  </Table1>
  <Table1>
    <productCategory>CreditCard</productCategory>
    <productType>MasterCard</productType>
    <countType>9</countType>
    <leadSource>Radio</leadSource>
    <countLeadSource>9</countLeadSource>
    <radioStation>Smooth FM</radioStation>
    <countRadioStation>9</countRadioStation>
  </Table1>
  <Table1>
    <productCategory>CreditCard</productCategory>
    <productType>MasterCard</productType>
    <countType>4</countType>
    <leadSource>Radio</leadSource>
    <countLeadSource>4</countLeadSource>
    <radioStation>TFM/Magic 1170</radioStation>
    <countRadioStation>4</countRadioStation>
  </Table1>
  <Table1>
    <productCategory>CreditCard</productCategory>
    <productType>Visa</productType>
    <countType>7</countType>
    <leadSource>Radio</leadSource>
    <countLeadSource>7</countLeadSource>
    <radioStation>Smooth FM</radioStation>
    <countRadioStation>7</countRadioStation>
  </Table1>

  <Table1>
    <productCategory>LoanClaim</productCategory>
    <productType>Secured Loan</productType>
    <countType>1</countType>
    <countLeadSource>1</countLeadSource>
    <countRadioStation>1</countRadioStation>
  </Table1>
  ...
</leaderBoard>

--
Best regards,
 Arthur                          mailto:ArthurM@xxxxxxxxxx

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-2011 All Rights Reserved.