xsl-list
[Top] [All Lists]

Re[2]: [xsl] Simple Metrics Can't see how to do a pattern

2008-06-12 01:37:08
Hello Michael,

Thanks Mike
I'm sure what you sent will work.
Note your comments will modify  what I send in future.

Thursday, June 12, 2008, 8:22:53 AM, you wrote:

I'm trying to sum "countType" for Table1 elements where 
productCategory=MasterCard.
Its not parsing.
What's the correct grammar for this?

It's much more productive to show us your code and the error message. Then
we can see where your misunderstandings lie, and we can try to explain what
you've misunderstood. For example, you might have the right expression, but
be executing it in the wrong context.

In the meantime, use

sum(Table1[productType='Amex']/countType)

with leaderBoard as the context node.

Michael Kay
http://www.saxonica.com/


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(_at_)seipas(_dot_)com


--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--


!DSPAM:4850cef3122436568615745!





-- 
Best regards,
 Arthur                            mailto:ArthurM(_at_)seipas(_dot_)com


--~------------------------------------------------------------------
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>