xsl-list
[Top] [All Lists]

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

2014-08-28 16:17:14
On Thu, Aug 28, 2014 at 11:03 AM, Eliot Kimber ekimber(_at_)contrext(_dot_)com
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> 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.
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>