xsl-list
[Top] [All Lists]

RE: [xsl] [XPath 3.0] Can anonymous functions return markup?

2012-12-16 17:41:42
I think only XQuery/XSLT functions can create new elements. 

There was a debate a few month ago regarding creating new elements in XPath
functions: 
http://www.biglist.com/lists/lists.mulberrytech.com/xsl-list/archives/201208
/msg00170.html

You may also find interesting Eric van der Vlist's suggestion for a new
syntax for writing values of @select in XSLT
https://www.w3.org/Bugs/Public/show_bug.cgi?id=18973

-----Original Message-----
From: Costello, Roger L. [mailto:costello(_at_)mitre(_dot_)org] 
Sent: Sunday, December 16, 2012 11:07 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] [XPath 3.0] Can anonymous functions return markup?

Hi Folks,

I want to create an anonymous XPath function that returns markup. For
example:

         let $print := function ()
                              {
                                  <hello>World</hello>
                              }
         return ($print())

I tried embedding that XPath within an xsl:sequence element:

      <xsl:sequence select="
         let $print := function ()
                              {
                                  <hello>World</hello>
                              }
         return ($print())
         " />

but that produced this error message:

    The value of attribute "select" associated with an element 
    type "xsl:sequence" must not contain the '<' character.

So I escaped the '<' characters:

      <xsl:sequence select="
         let $print := function ()
                              {
                                  &lt;hello>World&lt;/hello>
                              }
         return ($print())
         " />

and that produced this error message:

    Unexpected token "<" in path expression

Is it possible to create an anonymous function that returns markup? 

If yes, how?

/Roger

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--