Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


XSLT: selecting nested distinct records -- Help

From: svet_lana_p@-------.--- (----)
To: NULL
Date: 10/3/2004 12:01:00 PM
I'm just learning XSLT and am currently stuck trying to solve the
following problem.

My XML looks like this: 

<resultset>
- <record>
  	<field name="vchAdmin">XXX</field> 
  	<field name="vchRoot">1</field> 
  </record>
- <record>
  	<field name="vchAdmin">YYY</field> 
  	<field name="vchRoot">1</field>  
  </record>
- <record>
  	<field name="vchAdmin">YYY</field> 
  	<field name="vchRoot">2</field> 
  </record>
- <record>
  	<field name="vchAdmin">YYY</field>
  	<field name="vchRoot">2</field>  
  </record>
- <record>
  	<field name="vchAdmin">ZZZ</field> 
  	<field name="vchRoot">1</field> 
  </record>
- <record>
  	<field name="vchAdmin">ZZZ</field>
  	<field name="vchRoot">1</field>  
  </record>
<resultset>

What I need to achieve is to count # of DISTINCT vchRoot's PER
vchAdmin and place that into a different XML format.

In this case, my output has to be:

<resultset>
  <record> 
  	<vchAdmin>XXX</vchAdmin>
  	<iDistinctRoots>1</iDistinctRoots>
  </record>
  <record> 
  	<vchAdmin>YYY</vchAdmin>
  	<iDistinctRoots>2</iDistinctRoots>
  </record>
  <record> 
  	<vchAdmin>ZZZ</vchAdmin>
  	<iDistinctRoots>1</iDistinctRoots>
  </record>
</resultset>

I've tried using nested keys to first get distinct vchAdmin's and then
get and count distinct vchRoots for each vchAdmin but nothing seems to
work.

Please help?
Thank you in advance!!

XSLT Newby


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent