This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Complicated Table
- From: DEV SEN <devksen at prodigy dot net>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Tue, 1 Oct 2002 17:49:13 -0700 (PDT)
- Subject: Re: [xsl] Complicated Table
- Reply-to: xsl-list at lists dot mulberrytech dot com
Thanks!!!
--- Jeni Tennison <jeni@jenitennison.com> wrote:
> Hi Millie,
>
> > It's not even slightly clear to me where to start.
> How do the
> > attributes like "numcols" and "numrows" figure in,
> not to mention
> > how do you connect the variable "num" from
> column_info to the num
> > from the rows?
>
> I'd just ignore the numcols and numrows attributes.
> You don't need
> them to turn this XML into an table in HTML or
> XSL-FO. Just think of
> the mapping between the elements in your XML and the
> HTML or XSL-FO
> you want to create. For example for HTML:
>
> table => table
> column_info => th
> row => tr
> column => td
>
> Then for each of those mappings create a template:
>
> <xsl:template match="table">
> <table>
> <caption><xsl:value-of select="@name"
> /></caption>
> <tr>
> <xsl:apply-templates select="column_info" />
> </tr>
> <xsl:apply-templates select="row" />
> </table>
> </xsl:template>
>
> <xsl:template match="column_info">
> <th><xsl:value-of select="@name" /></th>
> </xsl:template>
>
> <xsl:template match="row">
> <tr><xsl:apply-templates /></tr>
> </xsl:template>
>
> <xsl:template match="column">
> <td><xsl:apply-templates /></td>
> </xsl:template>
>
> Something similar would apply for XSL-FO, but the
> names of the
> elements that you generate would be different.
>
> Cheers,
>
> Jeni
>
> ---
> Jeni Tennison
> http://www.jenitennison.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