You can avoid the XML nested tag problem by using ERB instead.

<% unless first_item? %>
 ....
<% end %>

ERB does actually use tag soup style parsing. (AKA stream-of-text as opposed to the tree style used by XML).

Bryan

On 11-04-13 12:18 AM, Robert wrote:
I have nested models (country, state, city) that I want to show all as
an html summary table.
hobo complains about missing closing</tr>  tag and I can't see a way
around it.
<REXML::ParseException: Missing end tag for 'tr' (line 7) (got
"unless")

here's the code that fails:

         <body:>
           <table>
           <repeat:countries>
             <tr>
             <td rowspan="#{this.child_elements}"><name/></td>
             <repeat:states>
               <unless test="&first_item?"><tr><td/></unless>
               <td rowspan="#{this.child_elements}"><name/></td>
               <if test="&this.child_elements.blank?"><td/></tr></if>
               <repeat:project1_dna_seq_exome_captures>
                 <unless test="&first_item?"><tr><td/><td/></unless>
                 <td><name/></td>
                 </tr>
               </repeat>
             </repeat>
           </repeat>
           </table>
         </body:>

Note: child_elements is a routine I defined in each model to count how
much rowspan is needed. That part works good and can be ignored.

What I'm expecting as output:

<table>
   <tr>
     <td rowspan="3">canada</td>
     <td rowspan="2">ontario</td>
     <td>toronto</td>
   </tr>
   <tr>
     <td/>
     <td/>
     <td>ottawa</td>
   </tr>
   <tr>
     <td/>
     <td rowspan="1">quebec</td>
     <td>montreal</td>
   </tr>
   <tr>
     <td rowspan="1">france</td>
     <td/>
     <td/>
   </tr>
</table>


--
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to