Subject: [xsl] generate unknow table From: "John Wang" <jwang@xxxxxxxxxxx> Date: Fri, 8 Jun 2001 12:25:27 -0500 |
Hi, All Here is my xml: <?xml version="1.0"?> <display> <title> <field id="sflbr">Br</field> <field id="sflcyc">Cycle</field> <field id="sfsts">P/I Status Description</field> <field id="pidate">P/I Date</field> </title> <data> <record> <sel>12</sel> <sflbr>001</sflbr> <sflcyc>200</sflcyc> <sfsts>This is a description</sfsts> <pidate>06-02-01</pidate> </record> <record> <sel>11</sel> <sflbr>002</sflbr> <sflcyc>210</sflcyc> <sfsts>This is a description too</sfsts> <pidate>06-11-01</pidate> </record> </data> </display> Here is my xsl: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> <xsl:template match="/"> <html> <body> <table border="1"> <xsl:apply-templates select="display/title"/> <xsl:apply-templates select="display/data"/> </table> </body> </html> </xsl:template> <xsl:template match="title"> <tr> <xsl:for-each select="field"> <td> <xsl:value-of select="."/> </td> </xsl:for-each> </tr> </xsl:template> <xsl:template match="data"> <xsl:for-each select="record"> <tr> <td> <xsl:value-of select="sflbr"/> </td> <td> <xsl:value-of select="sflcyc"/> </td> <td> <xsl:value-of select="sfsts"/> </td> <td> <xsl:value-of select="pidate"/> </td> </tr> </xsl:for-each> </xsl:template> </xsl:stylesheet> If you do the XSL transform, you will get the result I want to get. The problem is, when I write the XSL, I don't know the columns I want to display, until I read the coming XML. How can I get the field name such as sflbr, sflcyc, sfsts, pidata from the display/title/field@id? Thanks a lot. -John XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Saxon and Python, Thomas B. Passin | Thread | RE: [xsl] generate unknow table, John Wang |
RE: [xsl] Producing Excel spreadshe, John Putman | Date | Re: [xsl] Saxon and Python, Lars Marius Garshol |
Month |