Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XSLT: Result trees in variables

Reply
Thread Tools

XSLT: Result trees in variables

 
 
Aleksi Kallio
Guest
Posts: n/a
 
      08-14-2003
I'm passing a result tree fragment that holds multiple strings
(fieldnames, in this case) and in the called template I wan't to test if
a certain string contains any of those names.

I have this:

<xsl:apply-templates select="field">
<xsl:with-param name="element-names">
<names>
<name>foo</name>
<name>bar</name>
</names>
</xsl:with-param>
</xsl:apply-templates>

....

<xsl:template match="field">
<xslaram name="element-names" />

<xsl:variable name="search-element-names">
<result>
<xsl:for-each select="$element-names/names/name">
<xsl:if test="contains('foobar', text())">.</xsl:if>
</xsl:for-each>
</result>
</xsl:variable>

<xsl:variable name="search-condition" select="$search-element-names =
''" />


I get this:

Can not convert #RTREEFRAG to a NodeList!


What is the parser trying to say to me?

Any ideas how to fix it?

 
Reply With Quote
 
 
 
 
Patryk Dworznik
Guest
Posts: n/a
 
      08-14-2003
On Thu, 14 Aug 2003 16:02:31 +0300, Aleksi Kallio wrote:


> I get this:
>
> Can not convert #RTREEFRAG to a NodeList!
>
>
> What is the parser trying to say to me?
>
> Any ideas how to fix it?


Passing a fragment of XML tree to a variable you get a data
type called Result Tree Fragment, which is quite useful
to store chunks of XML tree but fails when used in an xpath expression.
To get this working you must convert rtf back to a node set by
applying the extension function node-set().
In order to use this you must first declare a proper extension namespace
in your stylesheet. Most likely your processor supports exslt:

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



--
Patryk Dworznik

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
i = 10; result = ++i - --i; How result become ZERO Lakshmi Sreekanth C Programming 52 09-23-2010 07:41 AM
Is the result of valid dynamic cast always equal to the result ofcorrespondent static cast? Pavel C++ 7 09-18-2010 11:35 PM
Binary search trees (AVL trees) jacob navia C Programming 34 01-08-2010 07:27 PM
simulation result is correct but synthesis result is not correct J.Ram VHDL 7 12-03-2008 01:26 PM
1. Ruby result: 101 seconds , 2. Java result:9.8 seconds, 3. Perl result:62 seconds Michael Tan Ruby 32 07-21-2005 03:23 PM



Advertisments