double distinct-values?

Hi, I´m a beginner in Tamino and i need some help…

I have a document like

44 01 0001 more info 44 01 0001 more info 44 06 0001 more info 67 03 0001 more info

…etc

and i know how can i get the total number or records of each code:

for $rec in distinct-values( input()/record)
let $node := ( input()/record[state=‘0001’ and code=$rec] )
return { $count(node) }

but, how can i display the total number of records of each code/subcode?

Thanks.

Try


let $codes:=distinct-values(for $rec in ( input()//record) return string-join(($rec/code, $rec/subcode),","))
for $c in $codes
let $code:=substring-before($c,",") 
let $subcode := substring-after($c,",")
let $nodes:=input()//record[state='0001' and code=$code and subcode=$subcode] 
return <node code="{$code}" subcode="{$subcode}">{ count($nodes) }</node>

Regards

Harald

It´s exactly what i need, and i obtain a quick response!

Thanks a lot, i would never find it.

<oops, deleted>