This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: newbie: problems computing output from variables
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] newbie: problems computing output from variables
- From: David Carlisle <davidc at nag dot co dot uk>
- Date: Wed, 7 Feb 2001 12:50:47 GMT
- References: <FBCE39CE4112D411AB3C00D0B7445969CF4430@mailpost.syzygy.net>
- Reply-To: xsl-list at lists dot mulberrytech dot com
> Xerces tells me that it is unable to convert #BOOLEAN to a NodeList.
which is a rather exact description of the problem (compared with
typical compiler error messages)
$edits[position() < 6].
you can only apply a filter [....] to a node list, and that produces
a current node list for which the predicate is true.
Your $edits variable (despite its name) does not contain nodes
it is a boolean (either true or false)
You have
<xsl:variable name="edits" select="id != edit_id"/>
so that select expression doesn't select any nodes, it just returns true
or false depending on whether id = edit_id. As you evaluate this in the
root template, and the child of the root is called faqs, both id and
edit_id will select an empty node set.
for node sets a != b is true if _any_ node in a has a string value that
is not equal to any node in b. In your case, both node sets are empty
so there are no nodes not equal, so the predicate is false.
> The point of this is to display only the *x most recently edited
> questions*
<xsl:template match="/">
<xsl:apply-templates
select="/faqs/faq[id != edit_id][last() - position() < 6]"/>
</xsl:template>
<xsl:template match="faq">
....
</xsl:template>
David
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit
http://www.star.net.uk/stats.asp
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list