[xsl] Sorting RTF

Subject: [xsl] Sorting RTF
From: Paul Hebble <maceo@xxxxxxxx>
Date: Thu, 18 Nov 2004 08:29:23 -0600
Hi all,

Apologies in advance if this is an FAQ (and I don't see how it couldn't
be), but several days of searching the web, usenet, and mailing lists
have not turned up a solution.

I'm using Saxon 7.8 with these namespaces:
	xmlns:exsl="http://exslt.org/common";
	xmlns:saxon="http://icl.com/saxon";
	extension-element-prefixes="saxon exsl"

Here's what I want to do:

<xsl:variable name="items">
	<xsl:apply-templates select="*"/>
</xsl:variable>
<xsl:for-each select="exsl:node-set($items)/*">
	<xsl:sort select="xs:dateTime(@dc:date)" order="descending"/>
	<xsl:copy-of select="."/>
</xsl:for-each>

Saxon responds to this with this error on the for-each line:
"An empty sequence is not allowed as the value in 'cast as' expression".

I know $items isn't empty because if I replace the for-each with a
copy-of, I get the expected nodes.  I have tried setting my stylesheet's
version to 1.0, 1.1, and 2.0, and I have also tried these:
	select="$items"
	select="$items/*"
	select="exsl:node-set($items)"
	select="saxon:node-set($items)"
	select="saxon:node-set($items)/*"

The last two give me this error:
"No function found matching saxon:node-set with one argument"
Which makes me think that maybe xmlns:saxon is wrong, but I haven't seen
any others in my searching.

Any help would be appreciated.

-- 
	Paul

Current Thread