RE: [xsl] XML to HTML... dynamic table headers from element names

Subject: RE: [xsl] XML to HTML... dynamic table headers from element names
From: Adam Griffin <agriffin@xxxxxxxxxxxx>
Date: Thu, 31 Oct 2002 08:01:58 -0500
Happy to help when I can.  Similar thing again, just make small change so
that its for all rows, for all data.


<tr>
<xsl:for-each select="Table[1]/*">
	<td><xsl:value-of select="local-name()"/></td>
</xsl:for-each>
</tr>
<xsl:for-each select="Table">
	<tr>
		<xsl:for-each select="*">
			<td><xsl:value-of select="." /></td>
		</xsl:for-each>
	</tr>
</xsl:for-each>




-----Original Message-----
From: Alan K. Gay [mailto:alan@xxxxxxxxxxxx]
Sent: Wednesday, October 30, 2002 10:49 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] XML to HTML... dynamic table headers from element
names


Tx ... got that working... would you be willing to help me then loop
back through all the tables to get the data?  

You effectively solved a problem I hadn't mentioned, which is the
variable number of children within <table> and the variable children
names.  Spy designer doesn't do variable element names (all hard-coded
from schema) so I haven't learned this piece yet (Books on the way from
Amazon.)

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Adam Griffin
Sent: Wednesday, October 30, 2002 3:15 PM
To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
Subject: RE: [xsl] XML to HTML... dynamic table headers from element
names

something to the effect of... see below ... should work. (only first row
of
data, read their names) this would eliminate the need for position test
of
if block.

-adam

<tr>
<xsl:for-each select="Table[1]/*">
	<xsl:value-of select="local-name()"/>
</xsl:for-each>
</tr>



-----Original Message-----
From: Alan K. Gay [mailto:alan@xxxxxxxxxxxx]
Sent: Wednesday, October 30, 2002 2:56 PM
To: XSLT List
Subject: [xsl] XML to HTML... dynamic table headers from element names


Just getting my feet wet. using XMLSpy stylesheet designer to help
guide.   I'm converting XML to HTML, which is Microsoft's recommended
way of controlling the import of XML into Excel.  I've got the
stylesheet below in productive use.  However, I want to make one key
change. I want the name of XML elements to become the text column
headings so I can deal with files that have dynamic column names.

Suggestions appreciated.     

Here is typical XML:
<NewDataSet>
	<Table>
		<Name>Linda Britt</Name>
		<RFQCount>324</RFQCount>
		<RFQResponseCount>556</RFQResponseCount>
	</Table>
</NewDataSet>




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread