Subject: Re: [xsl] Using values from one node tree to iterate/recurse over another set of nodes. (Newbie Question) From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Wed, 27 Feb 2008 17:35:34 +0100 |
Nothing too dramatic really -
<table> <tr> <th>ID</th> <th>Headline</th> <th>Bodycopy</th> <th>Picture</th> </tr> <tr> <td>2</th> <td>Fog in Channel, Europe Cut Off</td> <td>There was fog in the channel. No French cheese for us.</td> <td>cheese.png</td> </tr> <tr> <th>1</th> <td>Man Bite Dogs</td> <td>Today a man bit a dog</td> <td>dog.png</td> </tr> </table>
But the point is that the structure needs to be dynamic...
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/"> <html lang="en"> <head> <title>Example</title> </head> <body> <xsl:apply-templates select="view"/> </body> </html> </xsl:template>
<xsl:template match="view"> <xsl:apply-templates select="record_list"/> </xsl:template>
<xsl:template match="structure"> <tr> <xsl:apply-templates select="field"/> </tr> </xsl:template>
<xsl:template match="field"> <th> <xsl:value-of select="@label"/> </th> </xsl:template>
<xsl:template match="record"> <tr> <xsl:apply-templates select="*"/> </tr> </xsl:template>
<xsl:template match="record/*"> <td> <xsl:value-of select="."/> </td> </xsl:template>
Martin Honnen http://JavaScript.FAQTs.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Using values from one nod, Richard Dyce | Thread | Re: [xsl] Using values from one nod, Richard Dyce |
Re: [xsl] Using values from one nod, Richard Dyce | Date | Re: [xsl] Using values from one nod, Richard Dyce |
Month |