cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luca Morandini <luca.morandi...@tin.it>
Subject Re: SQLTransformer
Date Sat, 03 Sep 2005 22:57:17 GMT
Torsten Schlabach wrote:
> as if would allow for a generic XSLT which for example renders the rowset
> into an HTML table.
> 
> WDYT?

Not sure I understood you, but, if you want something like:
<table>
	<tr>
		<th>firstname</th>
		<th>lastname</th>
	</tr>
	<tr>
		<td>Schlabach</td>
		<td>Torsten</td>
	</tr>
</table>

You can have it with both XML formats.

It boils down to using "local-name()" instead of "@name" in the relevant 
XSLT, like:
<xsl:template match="rowset">
	<table>
		<xsl:apply-templates select="*"/>
	</table>
</xsl:template>		
	
<xsl:template match="row">
	<xsl:if test="position()=1">
		<tr>
			<xsl:for-each select="*">
  			 <th><xsl:value-of select="local-name()"/></th>
			</xsl:for-each>	
		</tr>
	</xsl:if>
	<tr>
		<xsl:for-each select="*">
			<td><xsl:value-of select="."/></td>
		</xsl:for-each>
	</tr>
</xsl:template>

On the other hand, the format you proposed is cleaner indeed.
	
Regards,

--------------------
    Luca Morandini
www.lucamorandini.it
--------------------


Mime
View raw message