Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xslt count with complex rule

Status
Not open for further replies.

janhes

Technical User
Jan 30, 2001
537
GB
I'm sure this has been asked before but I can't find the answer.
I have the following xml which I am processing by sorting using
<xsl:for-each select="//property[@type='MoveSuccess']">
<xsl:sort select="./property[@name='sourceace']" data-type="text" order="ascending"/>

When I get to a change of sourceace and targetace I need to output a count of the number of MoveSuccess elements I have procesed.
I have tried all sorts of combinations of rule. my current attempt loks like this using the variable ace (which contains the correct value Naa030 first time).
<xsl:value-of select="count(ancestor::moveBatchResults/descendant::property[$ace=concat(./property[@name='sourceSPV'],./property[@name='targetSPV'])])"/>

But I can't get the correct count.
Anyone got any ideas please



<?xml version="1.0" encoding="UTF-8"?>
<moveBatchResults>
<property type="MoveResultCVO">
<property name="moveResults" type="ArrayList">
<property type="MoveFailure">
<property type="MoveVO" name="moveVO">
<property name="movement" type="String">MOVE</property>
<property name="ace" type="String">aa030</property>
<property name="reasonCode" type="null"/>
</property>
<property name="errorMessage" type="String">Target ace must belong to Current ace</property>
</property>
<property type="MoveSuccess">
<property name="movement" type="String">MOVE</property>
<property name="Balance" type="Double">&#45;361344&#46;46</property>
<property name="cofElementInformationVOs" type="ArrayList">
<property type="ElementInformationVO">
<property name="Balance" type="Double">&#45;28545&#46;43</property>
<property name="clasNumber" type="String">10126584</property>
</property>
<property type="ElementInformationVO">
<property name="Balance" type="Double">&#45;92196&#46;87999999999</property>
<property name="clasNumber" type="String">10126584</property>
</property>
<property type="ElementInformationVO">
<property name="Balance" type="Double">&#45;240602&#46;15000000002</property>
<property name="clasNumber" type="String">10126584</property>
</property>
</property>
<property name="mfNo" type="String">aa550U&#45;00517</property>
<property name="targetace" type="String">aa030</property>
<property name="sourceace" type="String">aa029</property>
</property>
<property type="MoveSuccess">
<property name="movement" type="String">MOVE</property>
<property name="Balance" type="Double">1&#46;48929757415317E&#45;11</property>
<property name="cofElementInformationVOs" type="ArrayList">
<property type="ElementInformationVO">
<property name="Balance" type="Double">&#45;7&#46;275957614183426E&#45;12</property>
<property name="clasNumber" type="String">10115129</property>
</property>
<property type="ElementInformationVO">
<property name="Balance" type="Double">2&#46;546585164964199E&#45;11</property>
<property name="clasNumber" type="String">10115129</property>
</property>
<property type="ElementInformationVO">
<property name="Balance" type="Double">&#45;5&#46;684341886080801E&#45;13</property>
<property name="clasNumber" type="String">10115129</property>
</property>
<property type="ElementInformationVO">
<property name="capitalBalance" type="Double">&#45;2&#46;7284841053187847E&#45;12</property>
<property name="clasNumber" type="String">10115129</property>
</property>
</property>
<property name="mfNo" type="String">ooo50T&#45;00133</property>
<property name="targetace" type="String">aa030</property>
<property name="sourceace" type="String">N</property>
</property>
<property type="MoveSuccess">
<property name="movement" type="String">MOVE</property>
<property name="Balance" type="Double">&#45;2&#46;0463630789890885E&#45;12</property>
<property name="cofElementInformationVOs" type="ArrayList">
<property type="ElementInformationVO">
<property name="Balance" type="Double">&#45;2&#46;0463630789890885E&#45;12</property>
<property name="clasNumber" type="String">10119258</property>
</property>
</property>
<property name="mfNo" type="String">lll50K&#45;00023</property>
<property name="targetace" type="String">aa030</property>
<property name="sourceace" type="String">N</property>
</property>
</property>
</property>
</moveBatchResults>
 
It's ok I've solved it. I was using the wrong variable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top