|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Variable number of attributes
At 09:17 AM 09/30/2000 -0400, John E. Simpson wrote:
[Not 100% correct stylesheet] Sorry - copy-and-paste error. The example previously posted does not output the table headers. It should have actually been: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/TR/REC-html40" > <xsl:template match="/doc">
<html>
<head><title>Attributes to Elements</title></head>
<body>
<table>
<tr>
<xsl:for-each select="ele[1]/@*">
<th><xsl:value-of select="name()"/></th>
</xsl:for-each>
</tr>
<xsl:apply-templates />
</table>
</body>
</html>
</xsl:template> <xsl:template match="ele">
<tr>
<xsl:for-each select="@*">
<td><xsl:value-of select="."/></td>
</xsl:for-each>
</tr>
</xsl:template></xsl:stylesheet> And the output from Saxon is: <html xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Attributes to Elements</title>
</head>
<body>
<table>
<tr>
<th>name1</th>
<th>name2</th>
<th>name3</th>
</tr>
<tr>
<td>A1</td>
<td>A2</td>
<td>A3</td>
</tr>
<tr>
<td>B1</td>
<td>B2</td>
<td>B3</td>
</tr>
</table>
</body>
</html>Sorry for the wasted bandwidth! ========================================================== John E. Simpson | "Curiosity killed the cat, http://www.flixml.org | but for a while I was a XML Q&A: http://www.xml.com | suspect." (Steven Wright) XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|

Cart








