|
Subject: RE: Counter values in attributes?? From: "Wendu Cameron" <wcam001@xxxxxxxxxx> Date: Thu, 18 Feb 1999 19:33:22 +1100 |
It is my belief correct me if im wrong. But HTML is more powerful than that
you do not need to specify the colspan for the first row.
Just use
<TR>
<xsl:value-of Select="Container/@Descrition"/>
</TR>
<TR>
<xsl:for-each Select="Container">
<TD><xsl:value-of Select="Child"/></TD>
</xsl:for-each>
</TD>
Although this may not be stylistic I prefer a keep it simple approach'
Ohh and by the way make descrition an attribute not an element
Regards
> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxx]On Behalf Of Evan Easton
> Sent: Thursday, February 18, 1999 7:49 AM
> To: XSL-List@xxxxxxxxxxxxxxxx
> Subject: Counter values in attributes??
>
>
> I'd like some enlightenment on counters if there's any to be had. I'm
> having problems with this scenario: I have a parent tag (container)
> that contains a variable number of children. I want to prepare an HTML
> table that has a header cell containing the description of the
> container. I want this header cell to span the same number of columns
> as there are children.
>
> For example, the XML:
>
> <container>
> <description>My Kids</description>
> <child>Child 1</child>
> <child>Child 2</child>
> <child>Child 3</child>
> </container>
>
> Should get turned into a table like:
>
> +-----------------------------+
> | My Kids |
> +---------+---------+---------+
> | Child 1 | Child 2 | Child 3 |
> +---------+---------+---------+
>
> I'm trying to use a counter to count all the container's children. I
> have a template matching the child tag in the "count" mode which
> increments the "childCount" counter. Next I want to include the value
> of the "childCount" counter as the COLSPAN tag of the TD for the
> description header. I've tried all sorts of things to get the counter
> value as an attribute to no avail (See XSL below).
>
> ----------- XSL Snippet -----------
> <xsl:template match="container">
> <!-- COUNT MY CHILDREN -->
> <xsl:counter-reset name="childCount"/>
> <xsl:apply-templates select="child" mode="count"/>
>
> <TD COLSPAN="{../xsl:counters[@name='bubbleCount']/@value}">
> <xsl:apply-templates select="description"/>
> </TD>
> </xsl:template>
>
> <xsl:template match="child" mode="count">
> <xsl:counter-increment name="childCount"/>
> </xsl:template>
>
>
> So, is there a way to get the counter value other than <xsl:counter
> name="childCount"/> (which won't work in the attribute)? If not, how
> else might I solve this problem?
>
> Evan Easton
>
>
> 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 -> |
|---|---|---|
| Counter values in attributes??, Evan Easton | Thread | Re: Counter values in attributes??, Evan Easton |
| Immediate opening for XSL Pro!, Rick Ross | Date | Re: Counter values in attributes??, Guy_Murphy |
| Month |