Re: [xsl] Evaluating XSLT2 from code

Subject: Re: [xsl] Evaluating XSLT2 from code
From: "M. David Peterson" <m.david.x2x2x@xxxxxxxxx>
Date: Mon, 15 Aug 2005 00:22:49 -0600
Hi Andrew,

> Examples are almost non-existant and their mailing
> list has been completely unresponsive.

Which list are you sending messages to?  I've tried to get the word
out that the official support list for Saxon.NET is
'saxondotnet-help'.  Unfortunately not everyone reads the blog entries
on the project weblog (http://weblog.saxondotnet.org) and because I am
slammed at the moment working on a project that has my time booked
until the end of the month I havent had a chance to get the word out.
Unfortunately for some reason SF.net doesnt allow you to delete
mailing lists.  As such there are several lists there that are
inactive.

As I mentioned my time is limited at the moment, but if you can post a
message to the saxondotnet-help list I will take a look at this as
soon as I have a chance and respond back via that mechanism.

If there are others who have similar needs please visit >
http://lists.sourceforge.net/lists/listinfo/saxondotnet-help

Actually, in checking the archives I'm noticing a post from you
(Andrew) from the 29th of July to saxondotnet-help.  This is the first
I've seen this...  That worries me.  I will check and make sure there
isn't an error in the list-admin email address.  If you could post
your message again I can use this as a test.  If you don't get a
response within 12 hours or so then send a message directly to me and
I will get to the bottom of the problem.

Please note also that as per my last post to the project weblog >
http://weblog.saxondotnet.org/archives/2005/08/saxonnet_85_rc1_1.html
you can gain access to the Saxon.NET 8.5 bits via CVS.  I haven't had
the time necessary to run this release through the proper set of tests
and as such have not packaged it as an official release.  However, it
may be worth your while to checkout the Saxon.NET-Latest module from
the CVS repository on SF >
https://sourceforge.net/cvs/?group_id=112449

While there is no guarantee this will solve your problem it might be
worth the effort to give it a try.

See ya over on saxondotnet-help (hopefully :)

Cheers :)

On 8/11/05, Andrew Sharpe <andrewrwsharpe@xxxxxxxxx> wrote:
> Thanks very much Dr. Kay.  As I need to evaluate the
> expression from my Dotnet program, I tried your
> suggestion using Saxon.NET in C# like so:
>
> using net.sf.saxon;
> using net.sf.saxon.query;
> using net.sf.saxon.om;
> using javax.xml.parsers;
> using javax.xml.transform.dom;
> using org.w3c.dom;
>
> Configuration c = new Configuration();
> StaticQueryContext qp = new StaticQueryContext(c);
> qp.declareActiveNamespace("saxon",
> "http://saxon.sf.net/";);
> XQueryExpression xe =
> qp.compileQuery("format-date(<myxpath>,
> '[M]-[D]-[Y]')");
> DynamicQueryContext dqc = new DynamicQueryContext(c);
> DocumentBuilderFactory f =
> DocumentBuilderFactory.newInstance();
> DocumentBuilder d = f.newDocumentBuilder();
> Document doc = d.parse(new java.io.File(<myxmlfile>));
> DocumentInfo di = qp.buildDocument(new
> DOMSource(doc));
> dqc.setContextNode(di);
> java.util.List result = xe.evaluate(dqc);
>
> but received the all-too familiar :
>
> System.TypeLoadException was unhandled
>   Message="Method
> 'java.lang.Comparable/compareTo(Ljava.lang.Object;)I'
> on type 'net.sf.saxon.value.CalendarValue' from
> assembly 'Saxon.NET, Version=0.2.8.3, Culture=neutral,
> PublicKeyToken=039082bc3d203ffd' is overriding a
> method that has been overridden."
>   Source="Saxon.NET"
>   TypeName="net.sf.saxon.value.CalendarValue"
>   StackTrace:
>        at net.sf.saxon.value.Value.convert(Item item)
> ...
>
> I receive this exception quite often in my attempts to
> use Saxon.NET.  Their mailing list has proven
> unresponsive.
>
> If anyone out there is experienced with Saxon.NET and
> has suggestions, or anyone has any alternative
> suggestions (other than Saxon.NET) to evaluate
> "format-date(<myxpath>, '[M]-[D]-[Y]')" against a DOM
> in memory from within my Dotnet application, I would
> be very much appreciative.
>
> Thanks again,
>
> Andrew Sharpe
> Moncton, NB
> Canada
>
> > -----Original Message-----
> >Date: Wed, 10 Aug 2005 18:53:15 +0100
> >To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> >From: "Michael Kay" <mike@xxxxxxxxxxxx>
> >Subject: RE: [xsl] Evaluating XSLT2 from code
>
> >Saxon provides a mirror of the XSLT format-date()
> >function in the Saxon
> >namespace for use in XQuery, so
>
> >declare namespace saxon="http://saxon.sf.net/";;
> >saxon:format-date(....)
>
> >is a valid query and can be executed against a DOM
> >using the Saxon XQuery API.
>
> >Michael Kay
> >http://www.saxonica.com/
>
> >> -----Original Message-----
> >> From: Andrew Sharpe
> [mailto:andrewrwsharpe@xxxxxxxxx]
> >> Sent: 10 August 2005 13:54
> >> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> >> Subject: [xsl] Evaluating XSLT2 from code
> >>
> >> I would like to be able to evaluate XSLT2
> expressions
> >> against a DOM from within Dotnet.  I say XSLT2
> nstead
> >> of XPATH2 because I need to be able to use the new
> >> format-date function available in XSLT2 (not part
> of
> >> the XPath spec).  I have evaluated other date
> >> formatting approaches in XSLT1 and find them to be
> >> insufficient for what I need to do.
> >>
> >> Currently I am going through the painstaking
> process
> >> of wrapping the expression in an XSLT2 stylesheet,
> >> saving that stylesheet out to disk, and then
> executing
> >> Saxon8 as a separate command-line process and
> >> redicting the standard output of that process to my
> >> Dotnet program.  Surely there must be a better way.
> >>
> >> I have taken a look at Saxon.NET and find it to be
> a
> >> great idea but can't get even the simplest of
> >> in-memory transformations to work with a DOM.
> >> Examples are almost non-existant and their mailing
> >> list has been completely unresponsive.
> >>
> >> So to simplify, I would like to evaluate
> >> "format-date(/sample/path/@date, '[M]-[D]-[Y]')"
> >> against a DOM from within my Dotnet application.
> Any
> >> ideas at all would be much appreciated.  Thanks in
> >> advance,
> >>
> >> Andrew Sharpe
> >> Moncton, NB
> >> Canada
>
>
>
>
>
>
> __________________________________________________________
> Find your next car at http://autos.yahoo.ca
>
>


--
<M:D/>

M. David Peterson
http://www.xsltblog.com

Current Thread