I can apply a template on <prod> and would like to do so on <loc>, but how do I fill-in the location cells that do not have a value.
I've used the algorithm listed below, but THERE HAS TO BE A BETTER WAY!
(BTW, the alorithm below is an example of my procedural thinking.)
Any ideas?
template select="prod"
<tr>
<td>value-of select="prod/@name"</td>
choose
when select="loc[@name="loc1"]
<td>value-of "loc[@name="loc1]/price</td>
/when
other
<td> </td>
/other
/choose
choose
when select="loc[@name="loc2"]
<td>value-of "loc[@name="loc2]/price</td>
/when
other
<td> </td>
/other
/choose
choose
when select="loc[@name="loc3"]
<td>value-of "loc[@name="loc3]/price</td>
/when
other
<td> </td>
/other
/choose
choose
when select="loc[@name="loc4"]
<td>value-of "loc[@name="loc4]/price</td>
/when
other
<td> </td>
/other
/choose
Subject:Using a template instead of choose? Author:(Deleted User) Date:13 Apr 2007 04:12 AM
I don't think that your problem can be solved by applying a template, as you want to force both a display order and a default value; you could play with xsl:key to simulate a grouping operation, but given that you are just handling 4 locations, your code could be the quickest way to achieve it.