Re: [xsl] Re: Migrating XSLT (2.0) from appliance to Java?

Subject: Re: [xsl] Re: Migrating XSLT (2.0) from appliance to Java?
From: "Christophe Marchand cmarchand@xxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 22 Aug 2023 12:34:46 -0000
If your XSLT is 2.0 or 3.0, then with Java, you must add Saxon-HE to 
your classpath. Saxon-HE has some dependencies, see 
https://repo1.maven.org/maven2/net/sf/saxon/Saxon-HE/12.3/Saxon-HE-12.3.pom

Once done, your code should work correctly.

You may also have a look to Saxon documentation, and mainly on how to 
embed Saxon in a Java application : 
https://saxonica.com/documentation12/index.html#!using-xsl/embedding

Best regards,
Christophe

Le 22/08/2023 C  14:22, ohaya ohaya@xxxxxxxxx a C)critB :
> Hi,
>
> My apologies - I accidentally clicked "Send" before I had added my 
> text :( !!
>
> A while ago, (in February 2023), I had a thread where you all helped 
> me get an XSLT working.
>
> I think this was the thread in the archives:
>
> "Followup question: was Re: [xsl] XSLT to populate a SAML 
> AttributeStatement from an XML
>
> ohaya ohaya@xxxxxxxxx - 16 Feb 2023 14:51:32 -0000 "
>
> At that time, the XSLT was being used on a gateway appliance (a 
> Broadcom API Gateway), and after getting the XSLT work, we were put on 
> hold, but now they want to pick up where we left off, but instead of 
> the XSLT on the API Gateway, we need to use the XSLT on a Linux 
> machine, so I am trying to get it working with Java 1.8 now.
>
> This is the test Java app that I am trying to get working:
>
> =========================================================
>
> // Example from 
> http://www.java2s.com/Tutorials/Java/Java_XML/0200__Java_XSLT_Intro.htm
> //
> import javax.xml.transform.Transformer;
> import javax.xml.transform.TransformerFactory;
> import javax.xml.transform.stream.StreamResult;
> import javax.xml.transform.stream.StreamSource;
>
>
> public class Main {
>
> public static void main(String args[]) throws Exception {
> StreamSource source = new StreamSource(args[0]);
> StreamSource stylesource = new StreamSource(args[1]);
>
> TransformerFactory factory = TransformerFactory.newInstance();
> Transformer transformer = factory.newTransformer(stylesource);
>
> StreamResult result = new StreamResult(System.out);
> transformer.transform(source, result);
> }
> }
>
> =========================================================
>
> When I try to run the XSLT that we ended up with back in February 
> 2023, I am getting an error:
>
> "[root@dlwoas01 jl]# java Main X.xml X.xsl
> ERROR: 'Could not compile stylesheet'
> FATAL ERROR: 'Error checking type of the expression 'funcall(tokenize, 
> [step("self", -1), literal-expr(:)])'.'
> :Error checking type of the expression 'funcall(tokenize, 
> [step("self", -1), literal-expr(:)])'.
> "
> I suspect/guess that the problem is that the Java 1.8 only supports 
> XSLT 1.0, but I don't know if it is allowable to ask about this type 
> of thing here in this list, so I wanted to ask that first?
>
> Thanks in advance!!
>
> Jim
>
>
>
>
> On Tuesday, August 22, 2023 at 08:08:19 AM EDT, ohaya 
> <ohaya@xxxxxxxxx> wrote:
>
>
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/3515434> 
> (by email <>)

Current Thread