[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: generate unknow table

Subject: RE: generate unknow table
From: "John Wang" <jwang@xxxxxxxxxxx>
Date: Mon, 11 Jun 2001 15:26:27 -0500
RE:  generate unknow table
Hi, All

I have posted this question few days ago. It seems no body
even give a try to answer this question. Could someone tell
me this is impossible in XSLT? Or my question is not clear?

Thanks a lot in advance.


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



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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.