Count element name like ?

<ROWSET>
<ROW>
<first_name>Y</first_name>
<AAA_DIFF_FLG>N</AAA_DIFF_FLG>
<BBB_DIFF_FLG>Y</BBB_DIFF_FLG>
<CCC_DIFF_FLG>Y</CCC_DIFF_FLG>
</ROW>
<ROW>
<first_name>Y</first_name>
<AAA_DIFF_FLG>Y</AAA_DIFF_FLG>
<BBB_DIFF_FLG>N</BBB_DIFF_FLG>
<CCC_DIFF_FLG>N</CCC_DIFF_FLG>
</ROW>
</ROWSET>

count the element name like 'DIFF_FLG' with the value ='Y'.

Ooops,
Looks so simple, but was not able to do in 1o mins.
was struggling to get this today evening, thought will crack it tomorrow morning.
Didn;t get enough peace in mind, when i had my dinner.

cracked it in few mins :) when i was having my cup of milk in the night.

<?for-each:/ROWSET/ROW?>

cccccccc<?count(.//*[(name(.)=’CCC_DIFF_FLG’ or name(.)=’AAA_DIFF_FLG’ or name(.)=’BBB_DIFF_FLG’ ) and .=’Y’])?>
TTTTTc<?count(.//*[(substring-after(name(.),’_DIF’)=’F_FLG’ ) and .=’Y’])?>

-----------------
<?end for-each?>


May be , this can be sliced with better coding style, still cracked it :),
Having complete peace of mind now.

See you with an interesting article again :)

Comments

Popular posts from this blog

BIP Formatting

Repeat Table Header in all pages in BIP

Limit rows per page