XSLT: Result trees in variables

Discussion in 'XML' started by Aleksi Kallio, Aug 14, 2003.

  1. 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">
    <xsl:param 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?
     
    Aleksi Kallio, Aug 14, 2003
    #1
    1. Advertisements

  2. 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"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:exsl="http://exslt.org/common"
    extension-element-prefixes="exsl" >



    --
    Patryk Dworznik
     
    Patryk Dworznik, Aug 14, 2003
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    788
  2. J.Ram
    Replies:
    7
    Views:
    848
  3. jacob navia

    Binary search trees (AVL trees)

    jacob navia, Jan 3, 2010, in forum: C Programming
    Replies:
    34
    Views:
    1,829
    Dann Corbit
    Jan 8, 2010
  4. Pavel
    Replies:
    7
    Views:
    788
    Pavel
    Sep 19, 2010
  5. Lakshmi Sreekanth

    i = 10; result = ++i - --i; How result become ZERO

    Lakshmi Sreekanth, Sep 21, 2010, in forum: C Programming
    Replies:
    52
    Views:
    1,570
    Nick Keighley
    Sep 23, 2010
  6. Mr. Buffoon
    Replies:
    4
    Views:
    468
    Eric Sosman
    Sep 23, 2010
  7. Michael Tan
    Replies:
    32
    Views:
    1,585
    Ara.T.Howard
    Jul 21, 2005
  8. Andy Tolle
    Replies:
    7
    Views:
    429
    Andy Tolle
    Nov 15, 2010
Loading...