This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: newbie: problems computing output from variables




> 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() &lt; 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]