|
Subject: RE: RE: [xsl] How to implement an array From: Imrran Wahid <devguy2003@xxxxxxxxx> Date: Fri, 14 Feb 2003 07:55:49 -0800 (PST) |
Well I have corrected the problem by adding an
<xsl:if> to check if any children exist before
inserting a <td>. (If children exists then a column
will exist. So a <td> with or without data is
necessary. Otherwise no <td> will be created.
Here's the corrected template (I think it could be
cleaner or more elegant. But I'll tinker with it when
I learn more on XSL.)
<xsl:template match="Table1/Item" mode="celldata">
<xsl:variable name="thisitem" select="."/>
<tr>
<xsl:for-each select="$Table1Struct/Item/*">
<xsl:variable name="ItemName"
select="string(name(.))"/>
<xsl:if
test="count($thisitem/..//*[name(.)=$ItemName]) >
0">
<td>
<xsl:value-of
select="$thisitem/*[name()=name(current())]"/>
</td>
</xsl:if>
</xsl:for-each>
</tr>
</xsl:template>
I am still working on the parameter passing hurdle.
Hoping for some help from you guys.
Imrran
--- Imrran Wahid <devguy2003@xxxxxxxxx> wrote:
> Wendell,
> The template you suggested seemed to have a flaw.
...
> When no row in the table contains any element for a
> particular column that column is excluded from the
> colum heading. But the above template would insert a
> blank cell in the table. So we get
> Heading: Col1 Col2 Col3
> Data XXX YYY ZZZ
> Data XXX YYY ZZZ
>
> instead of:
> Heading: Col1 Col2 Col3
> Data XXX YYY ZZZ
> Data XXX YYY ZZZ
>
> I think it is necessary to check if elements exist
> for
> all children nodes before inserting a cell data
> (<td>
> element). That was the logic I was struggling with.
>
> Imrran
__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: RE: [xsl] How to implement an a, Imrran Wahid | Thread | RE: RE: [xsl] How to implement an a, Wendell Piez |
| RE: RE: [xsl] How to implement an a, Imrran Wahid | Date | RE: [xsl] Reference to variable can, Martinez, Brian |
| Month |