You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Servais Frederic <Fr...@capco.com> on 2000/08/09 15:08:58 UTC
RE: How to use param as xsl:sort select value?
The saxon processor uses an extension function to achieve this:
<xsl:sort select="saxon:evaluate($sortParam1)"
xmlns:saxon="http://icl.com/saxon"/>
Don't know if any equivalent extension exist for Xalan.
If you have any information on it I would be very grateful if you can
forward it to me.
Thanks a lot.
(I didn't see any response to your question in the mailing list)
Frederic
-----Original Message-----
From: everett stauffer [mailto:everett@chem.ucsd.edu]
Sent: Thursday, July 27, 2000 8:39 AM
To: xalan-dev
Subject: How to use param as xsl:sort select value?
Hello folks-
Using: RH 6.2, Apache 1.3.12, IBM Java 1.3, Tomcat 3.1, Xalan 1.2D01
Have used processor.setStylesheetParam(key, val) successfully to pass
a param to a stylesheet.
processor.setStylesheetParam("sortkey", processor.createXObject("COL2"));
<xsl:param name="sortkey" select="COL1"/>
can easily use it to do things like:
<xsl:choose>
<xsl:when test="name(.) = $sortkey">
...display the column header differently...
</xsl:when>
<xsl:otherwise>
...display the column header in standard way...
</xsl:otherwise>
</xsl:choose>
Want to use that param within a sort statement:
<xsl:sort select="$sortkey"/>
This iss 'accepted' (generates no errors) by Xalan, but the sort
doesn't occur.
On the other hand, using
<xsl:sort select="COL1"/>
works exactly as I expect.
Grabbed Xalan1.2 thinking that nodeset extension might do the
trick...but nodeset tells me that I'm passing in a String,
and not a result-frag.
What do I need to do to make the use of a param in a sort work?
Thanks,
Everett
************************************************************************
The information in this email is confidential and is intended solely
for the addressee(s).
Access to this email by anyone else is unauthorised. If you are not
an intended recipient, you must not read, use or disseminate the
information contained in the email.
Any views expressed in this message are those of the individual sender,
except where the sender specifically states them to be the views of
The Capital Markets Company.
http://www.capco.com
***********************************************************************
Re: How to use param as xsl:sort select value?
Posted by everett stauffer <ev...@chem.ucsd.edu>.
Actually, I hit on the following:
// global param
// pass in a stylesheet parameter
// setup a default value with the column name/string
<xsl:param name="sortkey" select="'DOC_NO'"/>
// inside a template
<xsl:apply-templates select="/*/*">
<xsl:sort select="./*[name(.) = $sortkey]"/>
</xsl:apply-templates>
// the template that does the real work has to have
// same match parameter as the 'sorter'
// this template will have sorted data
<xsl:template match="/*/*">
....
</xsl:template>
Everett
Servais Frederic wrote:
>
> The saxon processor uses an extension function to achieve this:
> <xsl:sort select="saxon:evaluate($sortParam1)"
> xmlns:saxon="http://icl.com/saxon"/>
> Don't know if any equivalent extension exist for Xalan.
>
> If you have any information on it I would be very grateful if you can
> forward it to me.
> Thanks a lot.
>
> (I didn't see any response to your question in the mailing list)
>
> Frederic
>
> -----Original Message-----
> From: everett stauffer [mailto:everett@chem.ucsd.edu]
> Sent: Thursday, July 27, 2000 8:39 AM
> To: xalan-dev
> Subject: How to use param as xsl:sort select value?
>
> Hello folks-
>
> Using: RH 6.2, Apache 1.3.12, IBM Java 1.3, Tomcat 3.1, Xalan 1.2D01
>
> Have used processor.setStylesheetParam(key, val) successfully to pass
> a param to a stylesheet.
>
> processor.setStylesheetParam("sortkey", processor.createXObject("COL2"));
>
> <xsl:param name="sortkey" select="COL1"/>
>
> can easily use it to do things like:
> <xsl:choose>
> <xsl:when test="name(.) = $sortkey">
> ...display the column header differently...
> </xsl:when>
> <xsl:otherwise>
> ...display the column header in standard way...
> </xsl:otherwise>
> </xsl:choose>
>
> Want to use that param within a sort statement:
> <xsl:sort select="$sortkey"/>
>
> This iss 'accepted' (generates no errors) by Xalan, but the sort
> doesn't occur.
>
> On the other hand, using
> <xsl:sort select="COL1"/>
> works exactly as I expect.
>
> Grabbed Xalan1.2 thinking that nodeset extension might do the
> trick...but nodeset tells me that I'm passing in a String,
> and not a result-frag.
>
> What do I need to do to make the use of a param in a sort work?
>
> Thanks,
>
> Everett
>
> ************************************************************************
> The information in this email is confidential and is intended solely
> for the addressee(s).
> Access to this email by anyone else is unauthorised. If you are not
> an intended recipient, you must not read, use or disseminate the
> information contained in the email.
> Any views expressed in this message are those of the individual sender,
> except where the sender specifically states them to be the views of
> The Capital Markets Company.
>
> http://www.capco.com
> ***********************************************************************