• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Table representation (nested-for loop) issue

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am using XSLT to transform the source xml to WordML (output). I need to present the following xml to table like/match the following format. I understand that, we can achieve this using nested xsl:for-each loop. But i dont know how. Any idea will be helpful.

Input xml:

<Question>
<Ques>Match the following people with their current or previous occupations. Not all people in the list have matches.</Ques>
<Option>Rube</Option>
<Option>George</Option>
<Option>Mason</Option>
<Option>Roxie</Option>
<Option>Daisy</Option>
<Option>Crystal</Option>
<Option>Delores</Option>
<Option>Blank</Option>
<Match>Leader of the reaper team</Match>
<Match>Unemployed</Match>
<Match>Drug Addict</Match>
<Match>Dancer</Match>
<Match>Actress</Match>
<Match>Blank</Match>
<Match>Blank</Match>
<Match>nun</Match>
</Question>

The output should be like the belo,

Rube Leader of the reaper team
Roxie Unemployed
Daisy Drug Addict
and so on...
 
Marshal
Posts: 27450
88
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It isn't obvious to me how to do that with nested xsl:for-each loops either. Maybe there's a complicated solution that I don't see right away.

I could do it with one xsl:for-each loop, but not nested loops. But I wouldn't do it that way, either, if it was my choice.

Do you have to do it with xsl:for-each loops for some reason?
 
karthik venkatesan
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Paul,

Thanks for your reply. There is no reason to use nested for-loop to achieve this. I thought we can achieve this using nested for-loop. I dont mind If I get the solution for this problem in some other way to achieve the results.

Thanks.

Regards,
Karthik
 
Wanna see my flashlight? How about this tiny ad?
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic