[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Code to Translate XSLT Functions to XQuery Functions?


Subject: Re: [xsl] Code to Translate XSLT Functions to XQuery Functions?
From: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 28 Aug 2014 21:17:02 -0000

On Thu, Aug 28, 2014 at 11:03 AM, Eliot Kimber ekimber@xxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> For the most part my functions
> are relatively simple and except for one that uses analyze-string, they
> are all implemented XPath expressions that will work as written in XQuery.



The <xsl:analyze-string> instruction now has its analogue as an XSLT
3.0 function: analyze-string(),
http://www.w3.org/TR/xpath-functions-30/#func-analyze-string

As for "translating" XSLT functions to XQuery functions, this may not
be generally possible, especially in the cases when the source
functions use functionality that is absent in XQuery, such as applying
templates.

If one writes their functions as XPath 3.0 inline function items, then
these are immediately usable both from XSLT and from XQuery, and from
any other language that hosts XPath 3.0. I would recommend this
approach, especially for writing future functions. Among other
benefits, one achieves a single and non-redundant source, that is used
by many hosting languages.

More on writing XPath 3.0 functions, and generally on XPath
programming, can be found here:

http://www.balisage.net/Proceedings/vol10/html/Novatchev01/BalisageVol10-Novatchev01.html


-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
To achieve the impossible dream, try going to sleep.
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they
write all patents, too? :)
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.


Current Thread
Keywords