Subject: Re: [xsl] Creating HTML by selecting XML attribute names From: "Joris Gillis" <roac@xxxxxxxxxx> Date: Thu, 15 Sep 2005 19:57:17 +0200 |
I am trying to convert some XML to HTML using the latest version of Xalan. However, I am having difficulty in selecting the correct elements from my XML source file. What I am trying to do is select the data from the rows/row/fields in the order it appears in the columns/column, and output it to a HTML table. The XML itself is generated so the attributes of the columns could change each time. I.e. in this example we have the attributes 'name' and 'age', but next time round they could be 'title', 'name', 'address'.
<xsl:template match="table"> <xsl:copy> <tr> <xsl:for-each select="$columns"> <th><xsl:value-of select="@label"/></th> </xsl:for-each> </tr> <xsl:apply-templates select="rows"/> </xsl:copy> </xsl:template>
<xsl:template match="field"> <xsl:variable name="field" select="."/> <tr> <xsl:for-each select="$columns"> <td> <xsl:copy-of select="@align"/> <xsl:value-of select="$field/@*[name()=current()/@field]"/> </td> </xsl:for-each> </tr> </xsl:template>
regards, -- Joris Gillis (http://users.telenet.be/root-jg/me.html) Fiat W3C in tenebris
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Creating HTML by selecting XM, Julian Karsten Arthu | Thread | [xsl] return something x number of , Jesper Tverskov |
[xsl] Creating HTML by selecting XM, Julian Karsten Arthu | Date | RE: [xsl] losing significant whites, Nick Fitzsimons |
Month |