This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Newbie question: dynamic output column ordering
- From: "Mike Bandy" <michael dot bandy at entegrity dot com>
- To: "XSL-List \(E-mail\)" <XSL-List at lists dot mulberrytech dot com>
- Date: Wed, 23 Jan 2002 09:17:04 -0500
- Subject: [xsl] Newbie question: dynamic output column ordering
- Reply-to: xsl-list at lists dot mulberrytech dot com
I'm new to XSL, doing HTML report generation from an XML file. I'm using
xalan with Java to drive my transformations and I'd like to be able to
specify the column ordering from my Java program. So, from the XML below,
I'd like to pass in the order, left to right, of the columns in my HTML
report - for example "job_id,sow_id,date_created" or
"date_created,job_id,file_name" or whatever based on the user's entries into
a Java GUI. (There's more to it than that, but this is where I'm stuck.)
How do I pass in the ordering and then break out the individual fields of
interest, then use the individual fields to extract the elements of
interest? I can do it all hardcoded (like below), but how do I make it
dynamic based on parameters from my Java program?
This seems like a FAQ but I can't find an answer online - sorry if this is
trivial.
Thanks.
Mike Bandy
Entegrity Solutions
Columbia Maryland
---- XSL snippet below ----
<xsl:template match="record">
<!--
Output one row of the HTML table
-->
<tr>
<td><strong><xsl:value-of select="job_id"/></strong></td>
<td><xsl:value-of select="sow_id"/></td>
<td><xsl:value-of select="date_completed"/></td>
</tr>
</xsl:template>
---- XML below ----
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<report>
<record>
<job_id>3Apserver_CORVETTE_01011209642894</job_id>
<sow_id>B0AEAA2B2C55F6A41701010691436119</sow_id>
<date_created>2002-01-16</date_created>
<date_completed></date_completed>
<status>Job Failed</status>
<file_name>CORVETTE/3Apserver_CORVETTE_0</file_name>
<file_size>10485760</file_size>
<source_name>Corvette</source_name>
<destination_name> </destination_name>
</record>
<record>
<job_id>102Apserver_CORVETTE_01011233583133</job_id>
<sow_id>B0AEAA2B2C55F6A41701010691436119</sow_id>
<date_created>2002-01-16</date_created>
<date_completed>2002-01-16</date_completed>
<status>Job Completed</status>
<file_name>CORVETTE/102Apserver_CORVETTE_0</file_name>
<file_size>10485760</file_size>
<source_name>Corvette</source_name>
<destination_name> </destination_name>
</record>
</report>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list