|
Subject: Re: [xsl] Replicating parent elements in table with children. From: "Ritu" <rkama@xxxxxxxxxxx> Date: Fri, 1 Nov 2002 14:36:40 -0600 |
Try this
<xsl:template match='/'>
<table>
<xsl:for-each select='NewDataSet/Table'>
<xsl:variable name='score' select='AvgScore'/>
<xsl:choose>
<xsl:when test='Table1'>
<xsl:for-each select='Table1'>
<tr><td><xsl:value-of select='$score'/></td>
<td><xsl:value-of select='DeliveryID'/></td></tr>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<tr><td><xsl:value-of select='AvgScore'/></td></tr>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</table>
</xsl:template>
----- Original Message -----
From: "Alan K. Gay" <alan@xxxxxxxxxxxx>
To: "XSLT List" <XSL-List@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Friday, November 01, 2002 2:01 PM
Subject: [xsl] Replicating parent elements in table with children.
> I have a parent <table> that can have zero to infinite <table1>. I'm
> trying to create an html table that, for each occurrence of <table1>,
> has the contents of <table> and <table1>. If there are no occurrences
> of <table1>, I still need the contents of <table>. Below is sample
> input and desired output.
>
> I need help with the looping/xpath approach to make this happen. Thanks
> in advance for any assistance.
>
> <NewDataSet>
> <Table>
> <AvgScore>323</AvgScore>
> <Table1>
> <DeliveryID>4102</DeliveryID>
> </Table1>
> <Table1>
> <DeliveryID>4103</DeliveryID>
> </Table1>
> <Table1>
> <DeliveryID>4104</DeliveryID>
> </Table1>
> </Table>
> <Table>
> <AvgScore>975</AvgScore>
> </Table>
> </NewDataSet>
>
> <table>
> <tr><td>323</td><td>4102</td></tr>
> <tr><td>323</td><td>4103</td></tr>
> <tr><td>323</td><td>4104</td></tr>
> <tr><td>975</td></tr>
> </table>
>
> Alan K. Gay
> ProBuild, Inc.
> http://www.probuild.com
>
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Replicating parent elemen, Mike Brown | Thread | RE: [xsl] Replicating parent elemen, Alan K. Gay |
| Re: [xsl] Replicating parent elemen, Mike Brown | Date | [xsl] Generating schema target name, Danny Vint |
| Month |