This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Applying two transformations consecutively
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>, "Griebel, Peer" <Peer dot Griebel at entire dot de>
- Subject: RE: [xsl] Applying two transformations consecutively
- From: "Schwartz, Rechell R, NLCIO" <rrschwartz at att dot com>
- Date: Mon, 25 Jun 2001 12:11:47 -0400
- Reply-To: xsl-list at lists dot mulberrytech dot com
Jeni,
Peer,
Thanks for your suggestions. One thing that may complicate things is that
I do my sorting based on parameters that the user enters at run-time that
specify the desired column to sort on, whether the column should be sorted
as text or as a number and whether the sort is ascending or descending.
I tried to incorporate your suggestions, but failed. Can you help me adjust
my
stylesheet so that I can get the TOTAL to stay on the bottom (and perhaps to
keep
the zero on the top until Apache fixes their bug)?
Thanks,
Rechell Schwartz
Here is a snippet of my stylesheet:
<xsl:template match="data">
<xsl:apply-templates select="row">
<xsl:sort select="*[name()=$sortcolumn]"
data-type="{$sort_type}" order="{$sortorder}"/>
</xsl:apply-templates>
</xsl:template>
Here is the relevant part of the XML:
<data>
<row>
<COLUMN1>0</COLUMN1><COLUMN2>ABC2</COLUMN2>
</row>
<row>
<COLUMN1>1</COLUMN1><COLUMN2>GHI2</COLUMN2>
</row>
<row>
<COLUMN1>2</COLUMN1><COLUMN2>DEF2</COLUMN2>
</row>
<row>
<COLUMN1>TOTAL</COLUMN1><COLUMN2>FBD1</COLUMN2>
</row>
</data>
-----Original Message-----
From: Jeni Tennison [mailto:mail@jenitennison.com]
Sent: Monday, June 25, 2001 11:16 AM
To: Griebel, Peer
Cc: 'XSL-List@lists.mulberrytech.com'
Subject: Re: [xsl] Applying two transformations consecutively
Hi Peer,
> If I use xsl:include only the rule defined last will be applied.
> What I would like to have is that the rule of the first file is
> executed first and the result is fed to the second rule.
You can do this with xsl:apply-imports. Have the first file *import*
the second file with xsl:import (which has to come before anything
else within xsl:stylesheet):
<xsl:import href="file2.xsl" />
And then use xsl:apply-imports in your template:
<xsl:template match="ELEMENT">
<xsl:variable name="result-from-file2">
<xsl:apply-imports />
</xsl:variable>
... something with $result-from-file2 ...
</xsl:template>
The processor takes the current node (the ELEMENT node) and tries to
find a template in any imported stylesheet that matches it, and
executes that.
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list