[thelist] xml question

Darren Darren at web-bitch.co.uk
Thu Aug 23 08:41:29 CDT 2001


ok, this is beginning to drive me mad, so if any one can help, many good
thoughts will be sent your way...

i have an xml document that is the output of a request i make,
unfortunately, i can't change the format i get this back in, so i'm stuck
with what i have.  i'm trying to display the data using xsl which, for
the most part, works.

part of the document has the following structure for multiple bookings:

   <booking>
      <adults>2</adults>
   </booking>
   <rate>
      <start>20010705</start>
      <occupants number="1">10</occupants>
      <occupants number="2">20</occupants>
   </rate>
   <booking>
      <adults>1</adults>
   </booking>
   <rate>
      <start>20010705</start>
      <occupants number="1">5</occupants>
      <occupants number="2">15</occupants>
   </rate>

what i need to do is display the correct rate depending on the number of
occupants, so for the above example you would have:

   adults:   2
   Rate:     20
   adults:   1
   Rate:     5

it's probably something screamingly obvious that i'm missing, but if i
loop through the <booking>'s with a <xsl:for-each...> how do i make sure
that i show the correct rate?

for one booking a <xsl:if...> takes care of matching the values up, but
i'm not sure how to guarantee that i get the correct rate data for the
associated booking.

hopefully that's clear,

thanks for any help,

darren.





More information about the thelist mailing list