Don't worry, XSLT is part of what we discuss in this Group. In fact,
it is a great favourite of mine.

Your HTML does not mirror the hierarchical structure of the XML
document in question so there is a slight complication. Otherwise the
XSLT is very simple. I did however change the element "childs" to
"children" because I like to be grammatically correct even in code.

Complete XSLT posted at :

http://dotnetdevelopment.pastebin.com/9Y6wWAt2

On Feb 25, 3:48 pm, Danny <[email protected]> wrote:
> Hi Guys,
>
> The title says xml so here's a question:
>
> My xml looks like this:
> <persons>
>         <person>
>                 <name>Name 1</name>
>                 <childs>
>                         <child>
>                                 <name>aa</name>
>                                 <age>10</age>
>                         </child>
>                         <child>
>                                 <name>bb</name>
>                                 <age>11</age>
>                         </child>
>                 </childs>
>         </person>
>         <person>
>                 <name>Name 2</name>
>                 <childs>
>                         <child>
>                                 <name>cc</name>
>                                 <age>12</age>
>                         </child>
>                         <child>
>                                 <name>dd</name>
>                                 <age>13</age>
>                         </child>
>                 </childs>
>         </person>
> </persons>
>
> And I need the resulting html to look like this:
> <html>
> <head>
>     <title></title>
> </head>
> <body>
>     <table border="1">
>         <tr>
>             <td rowspan="2">
>                 Name 1
>             </td>
>             <td>
>                 aa
>             </td>
>             <td>
>                 10
>             </td>
>         </tr>
>         <tr>
>             <td>
>                 bb
>             </td>
>             <td>
>                 11
>             </td>
>         </tr>
>         <tr>
>             <td rowspan="2">
>                 Name 2
>             </td>
>             <td>
>                 cc
>             </td>
>             <td>
>                 12
>             </td>
>         </tr>
>         <tr>
>             <td>
>                 dd
>             </td>
>             <td>
>                 13
>             </td>
>         </tr>
>     </table>
> </body>
> </html>
>
> So how should the xsl look like?
> Tried using templates but I cannot figure it out...
>
> Thanks in advance,
> Danny

Reply via email to