Hi Mukul,

Thank you for your reply. I know Xalan's extension function mechanism, but
my xslt 2.0 function implemention is different with extension function.For
example, we have the following XML document:

<?xml version="1.0"?>
<doc>
  <name first="David" last="Marston">David Marston</name>
  <name first="David" last="Bertoni">David Bertoni</name>
  <name first="Donald" last="Leslie">Donald Leslie</name>
  <name first="Emily" last="Farmer">Emily Farmer</name>
  <name first="Joseph" last="Kesselman">Joseph Kesselman</name>
  <name first="Myriam" last="Midy">Myriam Midy</name>
  <name first="Paul" last="Dick">Paul Dick</name>
  <name first="Stephen" last="Auriemma">Stephen Auriemma</name>
  <name first="Scott" last="Boag">Scott Boag</name>
  <name first="Shane" last="Curcuru">Shane Curcuru</name>
</doc>

If we want to find the guys with first name end with "d",we should use this
XPath to get these guys:

XPath:        /doc/name[ends-with(@first,'d')]
--------------------------------[1]

And also, if we use Xalan's extension function mechanism to achieve our
goal, we can use Xalan's str extensin function (http://exslt.org/strings) to
achieve our goal,also, we should  offer a expresion like this:

expresion:      str:endswith(/doc/na...@first],'d')
-----------------------------[2]

Let's compare [1] and [2], we can find that [1] is the normal XPath
expresion in XPath 2.0,but [2] is not.

If we google some key words such as "xpath ends-with" or "xpath upper-case",
we may found many developers want to know why XPath with functions
"ends-with","upper-case"(XPath 2.0 functions) can not execute
correctly,especially some junior developers, I think this confuses them.

So, this is why i want to implements XPath 2.0 functions for Xalan. And
implementing XPath 2.0 functions is just small part of my job. I want to
implement XSLT 2.0 datamodel too, and then implement all the XSLT 2.0
recommendation for Xalan. Michael (Michael Glavassevich/E-mail:
mrgla...@ca.ibm.com E-mail: mrgla...@apache.org) told me XSLT 2.0 is a large
specifications and that could take the developers years to implement
correctly,So,I want to achieve this step by step.  HAHA, expecting for your
advise

Best regards


2010/3/11 Mukul Gandhi <gandhi.mu...@gmail.com>

> Xalan offers mechanisms to call an external procedural code written in
> Java. Here is documentation for that,
> http://xml.apache.org/xalan-j/extensions.html
>
> You could use this extension mechanism provided by Xalan, to write
> your own custom functions, which you could call from the XSLT
> stylesheet.
>
> I wrote a related blog post, about this some time ago. Here's the link
> for that [1]:
>
> http://mukulgandhi.blogspot.com/2009/11/xslt-10-regular-expression-string.html
>
> Hope this [1] could be of some help too :)
>
> On Thu, Mar 11, 2010 at 12:23 PM, xunlong gui <ustbco...@gmail.com> wrote:
> > Hi everyone,
> >
> > I use xalan to convert one XML document to another format, my XML
> document
> > format is so complex that i have to use xpath 2.0 function (such as
> function
> > ends-with) to finish my job.But as we know, xalan support XPath 1.0
> > functions only. If i implement xpath 2.0 functions for xalan by myself,
> do
> > you think it is a good idea?In fact, i have started this job already,and
> i
> > hold it as a open source project upder apache licence 2.0, and named it
> > xslt2runner. you can find it by the following
> > url:http://code.google.com/p/xslt2runner/.
> >
> > Thank you & best regards :)
>
>
>
> --
> Regards,
> Mukul Gandhi
>

<<14.gif>>

Reply via email to