[xsl] selecting only one among many matching nodes..

Subject: [xsl] selecting only one among many matching nodes..
From: Zeynep Gunal <z.gunal@xxxxxxxxxxxxxxxx>
Date: Thu, 1 Mar 2001 18:14:25 +0100
Hi,

I have an XML that looks like this (I simplified the real one):

<AAA>
   <code>123</code>
   <BBB>
      <str1>abc</str1>
      <str2>def</str2>
      <str3>ghi</str3>
   <BBB>
   <CCC>
      <type>1</type>
      <code>123</code>
      <ret>5</ret>
      <DDD>
         <str1>abc</str1>
         <str2>def</str2>
         <str3>ghi</str3>
      </DDD>
   </CCC>
   <CCC>
      <type>3</type>
      <code>123</code>
      <ret>3</ret>
      <DDD>
         <str1>abc</str1>
         <str2>def</str2>
         <str3>ghi</str3>
      </DDD>
   </CCC>
   <CCC>
      <type>2</type>
      <code>123</code>
      <ret>1</ret>
      <DDD>
         <str1>ABC</str1>
         <str2>DEF</str2>
         <str3>GHI</str3>
      </DDD>
   </CCC>
   <CCC>
      <type>0</type>
      <code>123</code>
      <ret>4</ret>
      <DDD>
         <str1>abc</str1>
         <str2>def</str2>
         <str3>ghi</str3>
      </DDD>
   </CCC>
</AAA>

I need to find the smallest 'ret' value where:

AAA/code = AAA/CCC/code         and
AAA/BBB/str1 = AAA/CCC/DDD/str1 and
AAA/BBB/str2 = AAA/CCC/DDD/str2 and 
AAA/BBB/str3 = AAA/CCC/DDD/str3

which is here 3.

I am using XSLT, and I have been struggling for hours now, I searched the
archives, I found one similar question, but no answer and I could not find a
solution myself either. The only way I can think of doing it is using
something like do-while, but such an element/function is not supported by
XSLT.

Is there a solution?

Thanks in advance,

Zeynep

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread