cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Glenn <m...@mglenn.com>
Subject Re: XSLT Problem - need help
Date Wed, 15 Dec 1999 17:04:23 GMT
You need a template match for rowset as well as row. If there is no
additional HTML required for the rowset element simply pass along the
ability to process the row element.

<xsl:template match="rowset">
	<xsl:apply-templates select="row"/>
</xsl:template>

Since rowset and row are the only child elements at that level,
<xsl:apply-templates/> by itself will also suffice, however you may want
to leave the selects if you add additional elements to avoid ambiguity.

> tkrebs@attglobal.net wrote:
> 
> I am trying to transform the attached XML file with Cocoon into a
> simple HTML table presentation with ID and DESCRIPTION as table
> header. I tried different things, read the specs, but I am stucked.
> Depending whether I put a select in the "apply-templates" or not I get
> either only the table heading or all the text appearing just before
> the table.
> I would be grateful for any help
> 
> Thanks,
> Thomas
> 
> --- XML file ---
> <page>
> <rowset>
> <row>
>     <id>1</id>
>     <descr>blah</descr>
> </row>
> <row>
>     <id>2</id>
>     <descr>some other blah</descr>
> </row>
> </rowset>
> </page>
> 
> --- XSLT-file ----
> <xsl:template match="page">
> <html>
>     <head>
>         <title>
>             Some Title
>         </title>
>     </head>
>     <body>
>         <table border="2">
>             <tr>
>                 <td>ID</td>
>                 <td>Short Description</td>
>             </tr>
> 
>       <xsl:apply-templates select="rowset"/>
> 
>         </table>
>     </body>
> </html>
> </xsl:template>
> 
> <xsl:template match="row">
> <tr>
>     <td>
>         <xsl:value-of select="id"/>
>     </td>
>     <td>
>         <xsl:value-of select="descr"/>
>     </td>
> </tr>
> </xsl:template>

-- 
Michael Glenn
North 49 Design
http://www.mglenn.com

Mime
View raw message