[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Creating HTML by selecting XML attribute names
Hi,
Tempore 19:38:09, die 09/15/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Julian Karsten Arthur <julian.arthur@xxxxxxxxxxxxxxxxxx>: 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'. It seems all necessary information is included in the XML. Just try something like: <xsl:variable name="columns" select="/table/table-config/columns/column"/> <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>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|