Re: [xsl] using exsl:node-set()

Subject: Re: [xsl] using exsl:node-set()
From: "M. David Peterson" <m.david@xxxxxxxxxx>
Date: Mon, 26 Jul 2004 04:37:51 -0600
What processor are you using? I would personally recommend Saxon which implements the exslt node-set() function built into the architecture. But every other major processor either implements all or portions of the exslt functions or variations there of, which, other than namespace and syntax of the function names, perform the needed functionality you are looking for. This is not to suggest that the templates available at exslt.org are of no use... many of them will serve your needs quite well. But the node-set() function can not be implemented using an XSLT template. But it's the hard work and efforts of the exslt group that helped convince many of the processor vendors to build the outlined functionality directly into the processors themselves. By looking at the documentation that came with your processor you are more than likely to find exact details that outline how to implement that processors implementation of the node-set() function.

An example using Saxon:

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:exsl="http://exslt.org/common";
                extension-element-prefixes="exsl">

and then implement it in your stylesheet by using the namespace:function combination:

<xsl:variable name="foo">
...logic to build temporary tree
</xsl:variable>

<xsl:apply-templates select="exsl:node-set($foo)"/>

Best of luck!

<M:D/>
:: Saxon.NET general public early beta will be available Tuesday, July 27th ::
:: DISCLAIMER: All efforts have been made to ensure a quality beta release ::
:: None-the-less, this is an early beta release that should only be used ::
:: in test environments for the purpose of testing performance and helping ::
:: to locate potential bugs and performance bottlenecks. With this in mind ::
:: PLEASE DO NOT CONSIDER THIS RELEASE READY FOR PRODUCTION IMPLEMENTATION! ::


Markus Hanel wrote:
hallo,
I make something wrong! I want to use the exsl:node-set() function but at
www.exsl.org there is no download of the exsl.node-set.xsl stylesheet. But
in the main download there are two stylesheets: exsl.node-set.1.xsl and
exsl.node-set.2.xsl, but this not works.

markus

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:exsl="http://exslt.org/common"; extension-element-prefixes="exsl">

<xsl:import href="exsl.node-set.1.xsl" />
<xsl:import href="exsl.node-set.2.xsl" />

<xsl:template match="/">
<html>
<head><title></title></head>

<body>
  <xsl:apply-templates select="./table" />
</body>
</html>
</xsl:template>

<xsl:template match="table">
<xsl:variable name="sorted-rows-rtf">
    <xsl:for-each select="./row">
      <xsl:sort select="sum(./cell/@points)" data-type="number"
order="descending" />
      <xsl:copy-of select="." />
    </xsl:for-each>
  </xsl:variable>

  <xsl:variable name="sorted-rows"
select="exsl:node-set($sorted-rows-rtf)/row" />
  <xsl:value-of select="sum($sorted-rows[position() &lt;= 4]/cell/@points)"
/>
</xsl:template>
</xsl:stylesheet>

Current Thread