Just to explain in short the context.
I am trying to have one template to apply to different XML.
The XML can have these 3 possibilities:
A/ Only one accountNumber then One AccountName
B/ Two accountNumbers with same AccountName
C/ Two accountNumbers with different accountNames
Now I need to set a condition to check how many different account names I have:
In situation A/ the count should give me 1
In situation B/ the count should give me 1
In situation C/ the count should give me 2
I have this:
<xsl:key name="groupByAccountNumber" match="invoice/accountInvoiceElements" use="accountName" />
But when I do this:
<xsl:when test="count(key('groupByAccountNumber',accountName)) > 1">
I get wrong number...
A simplified sample XML is :
<invoice>
<accountInvoiceElements>
<invoiceElements>
......
</invoiceElements>
<invoiceElements>
......
</invoiceElements>
<accountName>Network Category 1</accountName>
<accountNumber>CORCA000009</accountNumber>
<isParent>0</isParent>
<taxTotal>34.286</taxTotal>
<totalAmount>265.726</totalAmount>
</accountInvoiceElements>
<accountInvoiceElements>
<invoiceElements>
......
</invoiceElements>
<invoiceElements>
......
</invoiceElements>
<accountName>Network Category 2</accountName>
<accountNumber>CORCA000009</accountNumber>
<isParent>1</isParent>
<taxTotal>34.286</taxTotal>
<totalAmount>265.726</totalAmount>
</accountInvoiceElements>
</invoice>
Any Help????