XSLT2.0 for JDK 1.4

View: New views
8 Messages — Rating Filter:   Alert me  

XSLT2.0 for JDK 1.4

by booitc :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm writting a Java application (based on JDK 1.4) to perform XSLT2.0
transformations, and i'm using Saxon 9.0.0.4j to implement this task.
According to saxon documentation, 9.0.0.4 supports JDK 1.4 or later. I get
the following exception when running my application:

java.lang.UnsupportedClassVersionError: net/sf/saxon/s9api/Destination
(Unsupported major.minor version 49.0)
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
Exception in thread "main"

I have saxon9-s9api.jar in my class path. I also tried including jaxp.jar
& dom.jar but that didn't make a difference. My source code:


package coza.openxcellence.transformations;

import net.sf.saxon.s9api.*;
import javax.xml.transform.stream.StreamSource;
import java.io.File;

public class SaxonTransformations {


        public static void main(String[] args) {

                try {
                        Processor processor = new Processor(false);
                        XsltCompiler compiler = processor.newXsltCompiler();
                        XsltExecutable exe = compiler.compile(new StreamSource(new
File("restructureInvoice.xsl")));

                        XdmNode document = processor.newDocumentBuilder().build(new
File("SourceXML.xml"));
                        XsltTransformer transformer = exe.load();
                        Serializer serializer = new Serializer();

                        serializer.setOutputProperty(Serializer.Property.METHOD, "xml");
                        serializer.setOutputProperty(Serializer.Property.VERSION, "1.0");
                        serializer.setOutputProperty(Serializer.Property.ENCODING, "UTF-8");
                        serializer.setOutputFile(new File("XSL Output.xml"));

                        transformer.setInitialContextNode(document);
                        transformer.setDestination(serializer);
                        transformer.transform();

                        System.out.println("Transformation performed successfully");
                }
                catch (Exception sae) {
                        sae.printStackTrace();
                }
        }
}

Is 9.0.0.4j the correct version for this task?

Looking forward to your response.
Thandu


-------------------------------------------
South Africas premier free email service - www.webmail.co.za
------------------------------------------------------------------
For super low premiums, click here http://www.webmail.co.za/dd.pwm


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@...
https://lists.sourceforge.net/lists/listinfo/saxon-help 

Re: XSLT2.0 for JDK 1.4

by Michael Kay :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The s9api interface, I'm afraid, requires JDK 1.5. This is stated in a
number of places including the package overview:

http://www.saxonica.com/documentation/javadoc/net/sf/saxon/s9api/package-sum
mary.html

and the description of the API provided when it was introduced:

http://www.saxonica.com/documentation/changes/s90/s9api90.html

This is why the s9api interface was packaged in a separate JAR file.

You can continue to use JDK 1.4 with Saxon 9.0 and 9.1, provided you don't
use the s9api interface.

Support for JDK 1.4 will probably be dropped altogether with Saxon 9.2
(people who want to use an old version of Java will probably be happy using
an old version of Saxon too).

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: saxon-help-bounces@...
> [mailto:saxon-help-bounces@...] On Behalf
> Of booitc@...
> Sent: 17 July 2008 19:37
> To: saxon-help@...
> Subject: [saxon] XSLT2.0 for JDK 1.4
>
> I'm writting a Java application (based on JDK 1.4) to perform
> XSLT2.0 transformations, and i'm using Saxon 9.0.0.4j to
> implement this task.
> According to saxon documentation, 9.0.0.4 supports JDK 1.4 or
> later. I get the following exception when running my application:
>
> java.lang.UnsupportedClassVersionError:
> net/sf/saxon/s9api/Destination (Unsupported major.minor version 49.0)
> at java.lang.ClassLoader.defineClass0(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
> at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.
> java:123)
> at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
> at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
> Exception in thread "main"
>
> I have saxon9-s9api.jar in my class path. I also tried
> including jaxp.jar & dom.jar but that didn't make a
> difference. My source code:
>
>
> package coza.openxcellence.transformations;
>
> import net.sf.saxon.s9api.*;
> import javax.xml.transform.stream.StreamSource;
> import java.io.File;
>
> public class SaxonTransformations {
>
>
> public static void main(String[] args) {
>
> try {
> Processor processor = new Processor(false);
> XsltCompiler compiler =
> processor.newXsltCompiler();
> XsltExecutable exe =
> compiler.compile(new StreamSource(new
> File("restructureInvoice.xsl")));
>
> XdmNode document =
> processor.newDocumentBuilder().build(new
> File("SourceXML.xml"));
> XsltTransformer transformer = exe.load();
> Serializer serializer = new Serializer();
>
>
> serializer.setOutputProperty(Serializer.Property.METHOD, "xml");
>
> serializer.setOutputProperty(Serializer.Property.VERSION, "1.0");
>
> serializer.setOutputProperty(Serializer.Property.ENCODING, "UTF-8");
> serializer.setOutputFile(new File("XSL
> Output.xml"));
>
> transformer.setInitialContextNode(document);
> transformer.setDestination(serializer);
> transformer.transform();
>
> System.out.println("Transformation
> performed successfully");
> }
> catch (Exception sae) {
> sae.printStackTrace();
> }
> }
> }
>
> Is 9.0.0.4j the correct version for this task?
>
> Looking forward to your response.
> Thandu
>
>
> -------------------------------------------
> South Africas premier free email service - www.webmail.co.za
> ------------------------------------------------------------------
> For super low premiums, click here http://www.webmail.co.za/dd.pwm
>
>
> --------------------------------------------------------------
> -----------
> This SF.Net email is sponsored by the Moblin Your Move
> Developer's challenge
> Build the coolest Linux based applications with Moblin SDK &
> win great prizes
> Grand prize is a trip for two to an Open Source event
> anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> saxon-help@...
> https://lists.sourceforge.net/lists/listinfo/saxon-help 


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@...
https://lists.sourceforge.net/lists/listinfo/saxon-help 

Re: XSLT2.0 for JDK 1.4

by booitc :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Michael

Am i correct in saying that i'll be using the saxon.jar to achieve XSLT2.0
transformations? I've downloaded the Saxon Resources file & i can't find
an example that doesn't use s9api to perform XSLT2.0 transformations.

Do you have an example i can refer to?

> The s9api interface, I'm afraid, requires JDK 1.5. This is stated in a
> number of places including the package overview:
>
> http://www.saxonica.com/documentation/javadoc/net/sf/saxon/s9api/package-sum
> mary.html
>
> and the description of the API provided when it was introduced:
>
> http://www.saxonica.com/documentation/changes/s90/s9api90.html
>
> This is why the s9api interface was packaged in a separate JAR file.
>
> You can continue to use JDK 1.4 with Saxon 9.0 and 9.1, provided you don't
> use the s9api interface.
>
> Support for JDK 1.4 will probably be dropped altogether with Saxon 9.2
> (people who want to use an old version of Java will probably be happy
> using
> an old version of Saxon too).
>
> Michael Kay
> http://www.saxonica.com/
>
>> -----Original Message-----
>> From: saxon-help-bounces@...
>> [mailto:saxon-help-bounces@...] On Behalf
>> Of booitc@...
>> Sent: 17 July 2008 19:37
>> To: saxon-help@...
>> Subject: [saxon] XSLT2.0 for JDK 1.4
>>
>> I'm writting a Java application (based on JDK 1.4) to perform
>> XSLT2.0 transformations, and i'm using Saxon 9.0.0.4j to
>> implement this task.
>> According to saxon documentation, 9.0.0.4 supports JDK 1.4 or
>> later. I get the following exception when running my application:
>>
>> java.lang.UnsupportedClassVersionError:
>> net/sf/saxon/s9api/Destination (Unsupported major.minor version 49.0)
>> at java.lang.ClassLoader.defineClass0(Native Method)
>> at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
>> at
>> java.security.SecureClassLoader.defineClass(SecureClassLoader.
>> java:123)
>> at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
>> at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
>> at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
>> at java.security.AccessController.doPrivileged(Native Method)
>> at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
>> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
>> Exception in thread "main"
>>
>> I have saxon9-s9api.jar in my class path. I also tried
>> including jaxp.jar & dom.jar but that didn't make a
>> difference. My source code:
>>
>>
>> package coza.openxcellence.transformations;
>>
>> import net.sf.saxon.s9api.*;
>> import javax.xml.transform.stream.StreamSource;
>> import java.io.File;
>>
>> public class SaxonTransformations {
>>
>>
>> public static void main(String[] args) {
>>
>> try {
>> Processor processor = new Processor(false);
>> XsltCompiler compiler =
>> processor.newXsltCompiler();
>> XsltExecutable exe =
>> compiler.compile(new StreamSource(new
>> File("restructureInvoice.xsl")));
>>
>> XdmNode document =
>> processor.newDocumentBuilder().build(new
>> File("SourceXML.xml"));
>> XsltTransformer transformer = exe.load();
>> Serializer serializer = new Serializer();
>>
>>
>> serializer.setOutputProperty(Serializer.Property.METHOD, "xml");
>>
>> serializer.setOutputProperty(Serializer.Property.VERSION, "1.0");
>>
>> serializer.setOutputProperty(Serializer.Property.ENCODING, "UTF-8");
>> serializer.setOutputFile(new File("XSL
>> Output.xml"));
>>
>> transformer.setInitialContextNode(document);
>> transformer.setDestination(serializer);
>> transformer.transform();
>>
>> System.out.println("Transformation
>> performed successfully");
>> }
>> catch (Exception sae) {
>> sae.printStackTrace();
>> }
>> }
>> }
>>
>> Is 9.0.0.4j the correct version for this task?
>>
>> Looking forward to your response.
>> Thandu
>>
>>
>> -------------------------------------------
>> South Africas premier free email service - www.webmail.co.za
>> ------------------------------------------------------------------
>> For super low premiums, click here http://www.webmail.co.za/dd.pwm
>>
>>
>> --------------------------------------------------------------
>> -----------
>> This SF.Net email is sponsored by the Moblin Your Move
>> Developer's challenge
>> Build the coolest Linux based applications with Moblin SDK &
>> win great prizes
>> Grand prize is a trip for two to an Open Source event
>> anywhere in the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> saxon-help mailing list archived at http://saxon.markmail.org/
>> saxon-help@...
>> https://lists.sourceforge.net/lists/listinfo/saxon-help
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
> world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> saxon-help@...
> https://lists.sourceforge.net/lists/listinfo/saxon-help
>



-------------------------------------------
South Africas premier free email service - www.webmail.co.za
------------------------------------------------------------------
For super low premiums, click here http://www.webmail.co.za/dd.pwm


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@...
https://lists.sourceforge.net/lists/listinfo/saxon-help 

Re: XSLT2.0 for JDK 1.4

by Michael Kay :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


You can use the JAXP API (package javax.xml.transform) to run
transformations. This is described in the Sun JDK documentation, and
information about the Saxon implementation is at

http://www.saxonica.com/documentation/using-xsl/embedding/jaxp-transformatio
n.html

There are examples in the TraxExamples.java sample application in the
saxon-resources download.

For some facilities specific to Saxon or to XSLT 2.0 (such as starting the
transformation at a named template), you may need to downcast from the JAXP
interface classes (such as javax.xml.transform.Transformer) to the Saxon
implementation class (in this case net.sf.saxon.Controller).

Michael Kay
http://www.saxonica.com/


> -----Original Message-----
> From: saxon-help-bounces@...
> [mailto:saxon-help-bounces@...] On Behalf
> Of booitc@...
> Sent: 18 July 2008 06:51
> To: Mailing list for the SAXON XSLT and XQuery processor
> Subject: Re: [saxon] XSLT2.0 for JDK 1.4
>
> Hi Michael
>
> Am i correct in saying that i'll be using the saxon.jar to
> achieve XSLT2.0 transformations? I've downloaded the Saxon
> Resources file & i can't find an example that doesn't use
> s9api to perform XSLT2.0 transformations.
>
> Do you have an example i can refer to?
>
> > The s9api interface, I'm afraid, requires JDK 1.5. This is
> stated in a
> > number of places including the package overview:
> >
> >
> http://www.saxonica.com/documentation/javadoc/net/sf/saxon/s9api/packa
> > ge-sum
> > mary.html
> >
> > and the description of the API provided when it was introduced:
> >
> > http://www.saxonica.com/documentation/changes/s90/s9api90.html
> >
> > This is why the s9api interface was packaged in a separate JAR file.
> >
> > You can continue to use JDK 1.4 with Saxon 9.0 and 9.1,
> provided you
> > don't use the s9api interface.
> >
> > Support for JDK 1.4 will probably be dropped altogether
> with Saxon 9.2
> > (people who want to use an old version of Java will
> probably be happy
> > using an old version of Saxon too).
> >
> > Michael Kay
> > http://www.saxonica.com/
> >
> >> -----Original Message-----
> >> From: saxon-help-bounces@...
> >> [mailto:saxon-help-bounces@...] On Behalf Of
> >> booitc@...
> >> Sent: 17 July 2008 19:37
> >> To: saxon-help@...
> >> Subject: [saxon] XSLT2.0 for JDK 1.4
> >>
> >> I'm writting a Java application (based on JDK 1.4) to
> perform XSLT2.0
> >> transformations, and i'm using Saxon 9.0.0.4j to implement
> this task.
> >> According to saxon documentation, 9.0.0.4 supports JDK 1.4
> or later.
> >> I get the following exception when running my application:
> >>
> >> java.lang.UnsupportedClassVersionError:
> >> net/sf/saxon/s9api/Destination (Unsupported major.minor
> version 49.0)
> >> at java.lang.ClassLoader.defineClass0(Native Method)
> >> at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
> >> at
> >> java.security.SecureClassLoader.defineClass(SecureClassLoader.
> >> java:123)
> >> at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
> >> at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
> >> at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
> >> at java.security.AccessController.doPrivileged(Native Method)
> >> at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
> >> at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
> >> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
> >> at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
> >> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
> >> Exception in thread "main"
> >>
> >> I have saxon9-s9api.jar in my class path. I also tried including
> >> jaxp.jar & dom.jar but that didn't make a difference. My
> source code:
> >>
> >>
> >> package coza.openxcellence.transformations;
> >>
> >> import net.sf.saxon.s9api.*;
> >> import javax.xml.transform.stream.StreamSource;
> >> import java.io.File;
> >>
> >> public class SaxonTransformations {
> >>
> >>
> >> public static void main(String[] args) {
> >>
> >> try {
> >> Processor processor = new Processor(false);
> >> XsltCompiler compiler =
> >> processor.newXsltCompiler();
> >> XsltExecutable exe =
> >> compiler.compile(new StreamSource(new
> >> File("restructureInvoice.xsl")));
> >>
> >> XdmNode document =
> >> processor.newDocumentBuilder().build(new
> >> File("SourceXML.xml"));
> >> XsltTransformer transformer = exe.load();
> >> Serializer serializer = new Serializer();
> >>
> >>
> >> serializer.setOutputProperty(Serializer.Property.METHOD, "xml");
> >>
> >> serializer.setOutputProperty(Serializer.Property.VERSION, "1.0");
> >>
> >> serializer.setOutputProperty(Serializer.Property.ENCODING,
> "UTF-8");
> >> serializer.setOutputFile(new File("XSL
> Output.xml"));
> >>
> >> transformer.setInitialContextNode(document);
> >> transformer.setDestination(serializer);
> >> transformer.transform();
> >>
> >> System.out.println("Transformation
> >> performed successfully");
> >> }
> >> catch (Exception sae) {
> >> sae.printStackTrace();
> >> }
> >> }
> >> }
> >>
> >> Is 9.0.0.4j the correct version for this task?
> >>
> >> Looking forward to your response.
> >> Thandu
> >>
> >>
> >> -------------------------------------------
> >> South Africas premier free email service - www.webmail.co.za
> >> ------------------------------------------------------------------
> >> For super low premiums, click here http://www.webmail.co.za/dd.pwm
> >>
> >>
> >> --------------------------------------------------------------
> >> -----------
> >> This SF.Net email is sponsored by the Moblin Your Move Developer's
> >> challenge Build the coolest Linux based applications with
> Moblin SDK
> >> & win great prizes Grand prize is a trip for two to an Open Source
> >> event anywhere in the world
> >> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> >> _______________________________________________
> >> saxon-help mailing list archived at http://saxon.markmail.org/ 
> >> saxon-help@...
> >> https://lists.sourceforge.net/lists/listinfo/saxon-help
> >
> >
> >
> ----------------------------------------------------------------------
> > --- This SF.Net email is sponsored by the Moblin Your Move
> Developer's
> > challenge Build the coolest Linux based applications with
> Moblin SDK &
> > win great prizes Grand prize is a trip for two to an Open
> Source event
> > anywhere in the world
> > http://moblin-contest.org/redirect.php?banner_id=100&url=/
> > _______________________________________________
> > saxon-help mailing list archived at http://saxon.markmail.org/ 
> > saxon-help@...
> > https://lists.sourceforge.net/lists/listinfo/saxon-help
> >
>
>
>
> -------------------------------------------
> South Africas premier free email service - www.webmail.co.za
> ------------------------------------------------------------------
> For super low premiums, click here http://www.webmail.co.za/dd.pwm
>
>
> --------------------------------------------------------------
> -----------
> This SF.Net email is sponsored by the Moblin Your Move
> Developer's challenge
> Build the coolest Linux based applications with Moblin SDK &
> win great prizes
> Grand prize is a trip for two to an Open Source event
> anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> saxon-help@...
> https://lists.sourceforge.net/lists/listinfo/saxon-help 


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@...
https://lists.sourceforge.net/lists/listinfo/saxon-help 

Re: XSLT2.0 for JDK 1.4

by booitc :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you for your assistance Michael. Will let you know when it's working...

>
> You can use the JAXP API (package javax.xml.transform) to run
> transformations. This is described in the Sun JDK documentation, and
> information about the Saxon implementation is at
>
> http://www.saxonica.com/documentation/using-xsl/embedding/jaxp-transformatio
> n.html
>
> There are examples in the TraxExamples.java sample application in the
> saxon-resources download.
>
> For some facilities specific to Saxon or to XSLT 2.0 (such as starting the
> transformation at a named template), you may need to downcast from the
> JAXP
> interface classes (such as javax.xml.transform.Transformer) to the Saxon
> implementation class (in this case net.sf.saxon.Controller).
>
> Michael Kay
> http://www.saxonica.com/
>
>
>> -----Original Message-----
>> From: saxon-help-bounces@...
>> [mailto:saxon-help-bounces@...] On Behalf
>> Of booitc@...
>> Sent: 18 July 2008 06:51
>> To: Mailing list for the SAXON XSLT and XQuery processor
>> Subject: Re: [saxon] XSLT2.0 for JDK 1.4
>>
>> Hi Michael
>>
>> Am i correct in saying that i'll be using the saxon.jar to
>> achieve XSLT2.0 transformations? I've downloaded the Saxon
>> Resources file & i can't find an example that doesn't use
>> s9api to perform XSLT2.0 transformations.
>>
>> Do you have an example i can refer to?
>>
>> > The s9api interface, I'm afraid, requires JDK 1.5. This is
>> stated in a
>> > number of places including the package overview:
>> >
>> >
>> http://www.saxonica.com/documentation/javadoc/net/sf/saxon/s9api/packa
>> > ge-sum
>> > mary.html
>> >
>> > and the description of the API provided when it was introduced:
>> >
>> > http://www.saxonica.com/documentation/changes/s90/s9api90.html
>> >
>> > This is why the s9api interface was packaged in a separate JAR file.
>> >
>> > You can continue to use JDK 1.4 with Saxon 9.0 and 9.1,
>> provided you
>> > don't use the s9api interface.
>> >
>> > Support for JDK 1.4 will probably be dropped altogether
>> with Saxon 9.2
>> > (people who want to use an old version of Java will
>> probably be happy
>> > using an old version of Saxon too).
>> >
>> > Michael Kay
>> > http://www.saxonica.com/
>> >
>> >> -----Original Message-----
>> >> From: saxon-help-bounces@...
>> >> [mailto:saxon-help-bounces@...] On Behalf Of
>> >> booitc@...
>> >> Sent: 17 July 2008 19:37
>> >> To: saxon-help@...
>> >> Subject: [saxon] XSLT2.0 for JDK 1.4
>> >>
>> >> I'm writting a Java application (based on JDK 1.4) to
>> perform XSLT2.0
>> >> transformations, and i'm using Saxon 9.0.0.4j to implement
>> this task.
>> >> According to saxon documentation, 9.0.0.4 supports JDK 1.4
>> or later.
>> >> I get the following exception when running my application:
>> >>
>> >> java.lang.UnsupportedClassVersionError:
>> >> net/sf/saxon/s9api/Destination (Unsupported major.minor
>> version 49.0)
>> >> at java.lang.ClassLoader.defineClass0(Native Method)
>> >> at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
>> >> at
>> >> java.security.SecureClassLoader.defineClass(SecureClassLoader.
>> >> java:123)
>> >> at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
>> >> at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
>> >> at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
>> >> at java.security.AccessController.doPrivileged(Native Method)
>> >> at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
>> >> at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
>> >> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
>> >> at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
>> >> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
>> >> Exception in thread "main"
>> >>
>> >> I have saxon9-s9api.jar in my class path. I also tried including
>> >> jaxp.jar & dom.jar but that didn't make a difference. My
>> source code:
>> >>
>> >>
>> >> package coza.openxcellence.transformations;
>> >>
>> >> import net.sf.saxon.s9api.*;
>> >> import javax.xml.transform.stream.StreamSource;
>> >> import java.io.File;
>> >>
>> >> public class SaxonTransformations {
>> >>
>> >>
>> >> public static void main(String[] args) {
>> >>
>> >> try {
>> >> Processor processor = new Processor(false);
>> >> XsltCompiler compiler =
>> >> processor.newXsltCompiler();
>> >> XsltExecutable exe =
>> >> compiler.compile(new StreamSource(new
>> >> File("restructureInvoice.xsl")));
>> >>
>> >> XdmNode document =
>> >> processor.newDocumentBuilder().build(new
>> >> File("SourceXML.xml"));
>> >> XsltTransformer transformer = exe.load();
>> >> Serializer serializer = new Serializer();
>> >>
>> >>
>> >> serializer.setOutputProperty(Serializer.Property.METHOD, "xml");
>> >>
>> >> serializer.setOutputProperty(Serializer.Property.VERSION, "1.0");
>> >>
>> >> serializer.setOutputProperty(Serializer.Property.ENCODING,
>> "UTF-8");
>> >> serializer.setOutputFile(new File("XSL
>> Output.xml"));
>> >>
>> >> transformer.setInitialContextNode(document);
>> >> transformer.setDestination(serializer);
>> >> transformer.transform();
>> >>
>> >> System.out.println("Transformation
>> >> performed successfully");
>> >> }
>> >> catch (Exception sae) {
>> >> sae.printStackTrace();
>> >> }
>> >> }
>> >> }
>> >>
>> >> Is 9.0.0.4j the correct version for this task?
>> >>
>> >> Looking forward to your response.
>> >> Thandu
>> >>
>> >>
>> >> -------------------------------------------
>> >> South Africas premier free email service - www.webmail.co.za
>> >> ------------------------------------------------------------------
>> >> For super low premiums, click here http://www.webmail.co.za/dd.pwm
>> >>
>> >>
>> >> --------------------------------------------------------------
>> >> -----------
>> >> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> >> challenge Build the coolest Linux based applications with
>> Moblin SDK
>> >> & win great prizes Grand prize is a trip for two to an Open Source
>> >> event anywhere in the world
>> >> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> >> _______________________________________________
>> >> saxon-help mailing list archived at http://saxon.markmail.org/
>> >> saxon-help@...
>> >> https://lists.sourceforge.net/lists/listinfo/saxon-help
>> >
>> >
>> >
>> ----------------------------------------------------------------------
>> > --- This SF.Net email is sponsored by the Moblin Your Move
>> Developer's
>> > challenge Build the coolest Linux based applications with
>> Moblin SDK &
>> > win great prizes Grand prize is a trip for two to an Open
>> Source event
>> > anywhere in the world
>> > http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> > _______________________________________________
>> > saxon-help mailing list archived at http://saxon.markmail.org/
>> > saxon-help@...
>> > https://lists.sourceforge.net/lists/listinfo/saxon-help
>> >
>>
>>
>>
>> -------------------------------------------
>> South Africas premier free email service - www.webmail.co.za
>> ------------------------------------------------------------------
>> For super low premiums, click here http://www.webmail.co.za/dd.pwm
>>
>>
>> --------------------------------------------------------------
>> -----------
>> This SF.Net email is sponsored by the Moblin Your Move
>> Developer's challenge
>> Build the coolest Linux based applications with Moblin SDK &
>> win great prizes
>> Grand prize is a trip for two to an Open Source event
>> anywhere in the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> saxon-help mailing list archived at http://saxon.markmail.org/
>> saxon-help@...
>> https://lists.sourceforge.net/lists/listinfo/saxon-help
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
> world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> saxon-help@...
> https://lists.sourceforge.net/lists/listinfo/saxon-help
>


-------------------------------------------
South Africas premier free email service - www.webmail.co.za
------------------------------------------------------------------
For super low premiums, click here http://www.webmail.co.za/dd.pwm

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@...
https://lists.sourceforge.net/lists/listinfo/saxon-help 

request for prices_AXIZ_180708.doc (41K) Download Attachment

Re: XSLT2.0 for JDK 1.4

by booitc :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Downcasting from javax.xml.transform.Transformer to
net.sf.saxon.Controller works. The following also works:

 TransformerFactory factory = new TransformerFactoryImpl();
 Templates templates = factory.newTemplates(new StreamSource(stylesheet));
 Transformer transformer = templates.newTransformer();
 transformer.transform(new StreamSource(source), new StreamResult(out));

Thanks for your assistance!

>
> You can use the JAXP API (package javax.xml.transform) to run
> transformations. This is described in the Sun JDK documentation, and
> information about the Saxon implementation is at
>
> http://www.saxonica.com/documentation/using-xsl/embedding/jaxp-transformatio
> n.html
>
> There are examples in the TraxExamples.java sample application in the
> saxon-resources download.
>
> For some facilities specific to Saxon or to XSLT 2.0 (such as starting the
> transformation at a named template), you may need to downcast from the
> JAXP
> interface classes (such as javax.xml.transform.Transformer) to the Saxon
> implementation class (in this case net.sf.saxon.Controller).
>
> Michael Kay
> http://www.saxonica.com/
>
>
>> -----Original Message-----
>> From: saxon-help-bounces@...
>> [mailto:saxon-help-bounces@...] On Behalf
>> Of booitc@...
>> Sent: 18 July 2008 06:51
>> To: Mailing list for the SAXON XSLT and XQuery processor
>> Subject: Re: [saxon] XSLT2.0 for JDK 1.4
>>
>> Hi Michael
>>
>> Am i correct in saying that i'll be using the saxon.jar to
>> achieve XSLT2.0 transformations? I've downloaded the Saxon
>> Resources file & i can't find an example that doesn't use
>> s9api to perform XSLT2.0 transformations.
>>
>> Do you have an example i can refer to?
>>
>> > The s9api interface, I'm afraid, requires JDK 1.5. This is
>> stated in a
>> > number of places including the package overview:
>> >
>> >
>> http://www.saxonica.com/documentation/javadoc/net/sf/saxon/s9api/packa
>> > ge-sum
>> > mary.html
>> >
>> > and the description of the API provided when it was introduced:
>> >
>> > http://www.saxonica.com/documentation/changes/s90/s9api90.html
>> >
>> > This is why the s9api interface was packaged in a separate JAR file.
>> >
>> > You can continue to use JDK 1.4 with Saxon 9.0 and 9.1,
>> provided you
>> > don't use the s9api interface.
>> >
>> > Support for JDK 1.4 will probably be dropped altogether
>> with Saxon 9.2
>> > (people who want to use an old version of Java will
>> probably be happy
>> > using an old version of Saxon too).
>> >
>> > Michael Kay
>> > http://www.saxonica.com/
>> >
>> >> -----Original Message-----
>> >> From: saxon-help-bounces@...
>> >> [mailto:saxon-help-bounces@...] On Behalf Of
>> >> booitc@...
>> >> Sent: 17 July 2008 19:37
>> >> To: saxon-help@...
>> >> Subject: [saxon] XSLT2.0 for JDK 1.4
>> >>
>> >> I'm writting a Java application (based on JDK 1.4) to
>> perform XSLT2.0
>> >> transformations, and i'm using Saxon 9.0.0.4j to implement
>> this task.
>> >> According to saxon documentation, 9.0.0.4 supports JDK 1.4
>> or later.
>> >> I get the following exception when running my application:
>> >>
>> >> java.lang.UnsupportedClassVersionError:
>> >> net/sf/saxon/s9api/Destination (Unsupported major.minor
>> version 49.0)
>> >> at java.lang.ClassLoader.defineClass0(Native Method)
>> >> at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
>> >> at
>> >> java.security.SecureClassLoader.defineClass(SecureClassLoader.
>> >> java:123)
>> >> at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
>> >> at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
>> >> at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
>> >> at java.security.AccessController.doPrivileged(Native Method)
>> >> at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
>> >> at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
>> >> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
>> >> at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
>> >> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
>> >> Exception in thread "main"
>> >>
>> >> I have saxon9-s9api.jar in my class path. I also tried including
>> >> jaxp.jar & dom.jar but that didn't make a difference. My
>> source code:
>> >>
>> >>
>> >> package coza.openxcellence.transformations;
>> >>
>> >> import net.sf.saxon.s9api.*;
>> >> import javax.xml.transform.stream.StreamSource;
>> >> import java.io.File;
>> >>
>> >> public class SaxonTransformations {
>> >>
>> >>
>> >> public static void main(String[] args) {
>> >>
>> >> try {
>> >> Processor processor = new Processor(false);
>> >> XsltCompiler compiler =
>> >> processor.newXsltCompiler();
>> >> XsltExecutable exe =
>> >> compiler.compile(new StreamSource(new
>> >> File("restructureInvoice.xsl")));
>> >>
>> >> XdmNode document =
>> >> processor.newDocumentBuilder().build(new
>> >> File("SourceXML.xml"));
>> >> XsltTransformer transformer = exe.load();
>> >> Serializer serializer = new Serializer();
>> >>
>> >>
>> >> serializer.setOutputProperty(Serializer.Property.METHOD, "xml");
>> >>
>> >> serializer.setOutputProperty(Serializer.Property.VERSION, "1.0");
>> >>
>> >> serializer.setOutputProperty(Serializer.Property.ENCODING,
>> "UTF-8");
>> >> serializer.setOutputFile(new File("XSL
>> Output.xml"));
>> >>
>> >> transformer.setInitialContextNode(document);
>> >> transformer.setDestination(serializer);
>> >> transformer.transform();
>> >>
>> >> System.out.println("Transformation
>> >> performed successfully");
>> >> }
>> >> catch (Exception sae) {
>> >> sae.printStackTrace();
>> >> }
>> >> }
>> >> }
>> >>
>> >> Is 9.0.0.4j the correct version for this task?
>> >>
>> >> Looking forward to your response.
>> >> Thandu
>> >>
>> >>
>> >> -------------------------------------------
>> >> South Africas premier free email service - www.webmail.co.za
>> >> ------------------------------------------------------------------
>> >> For super low premiums, click here http://www.webmail.co.za/dd.pwm
>> >>
>> >>
>> >> --------------------------------------------------------------
>> >> -----------
>> >> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> >> challenge Build the coolest Linux based applications with
>> Moblin SDK
>> >> & win great prizes Grand prize is a trip for two to an Open Source
>> >> event anywhere in the world
>> >> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> >> _______________________________________________
>> >> saxon-help mailing list archived at http://saxon.markmail.org/
>> >> saxon-help@...
>> >> https://lists.sourceforge.net/lists/listinfo/saxon-help
>> >
>> >
>> >
>> ----------------------------------------------------------------------
>> > --- This SF.Net email is sponsored by the Moblin Your Move
>> Developer's
>> > challenge Build the coolest Linux based applications with
>> Moblin SDK &
>> > win great prizes Grand prize is a trip for two to an Open
>> Source event
>> > anywhere in the world
>> > http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> > _______________________________________________
>> > saxon-help mailing list archived at http://saxon.markmail.org/
>> > saxon-help@...
>> > https://lists.sourceforge.net/lists/listinfo/saxon-help
>> >
>>
>>
>>
>> -------------------------------------------
>> South Africas premier free email service - www.webmail.co.za
>> ------------------------------------------------------------------
>> For super low premiums, click here http://www.webmail.co.za/dd.pwm
>>
>>
>> --------------------------------------------------------------
>> -----------
>> This SF.Net email is sponsored by the Moblin Your Move
>> Developer's challenge
>> Build the coolest Linux based applications with Moblin SDK &
>> win great prizes
>> Grand prize is a trip for two to an Open Source event
>> anywhere in the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> saxon-help mailing list archived at http://saxon.markmail.org/
>> saxon-help@...
>> https://lists.sourceforge.net/lists/listinfo/saxon-help
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
> world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> saxon-help@...
> https://lists.sourceforge.net/lists/listinfo/saxon-help
>



-------------------------------------------
South Africas premier free email service - www.webmail.co.za
------------------------------------------------------------------
For super low premiums, click here http://www.webmail.co.za/dd.pwm


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@...
https://lists.sourceforge.net/lists/listinfo/saxon-help 

Re: XSLT2.0 for JDK 1.4

by andrew welch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2008/7/21  <booitc@...>:
> Downcasting from javax.xml.transform.Transformer to
> net.sf.saxon.Controller works. The following also works:
>
>  TransformerFactory factory = new TransformerFactoryImpl();
>  Templates templates = factory.newTemplates(new StreamSource(stylesheet));
>  Transformer transformer = templates.newTransformer();
>  transformer.transform(new StreamSource(source), new StreamResult(out));

Mike meant to do XSLT 2.0 things such as setting the initial template
(which aren't part of JAXP as that only supports XSLT 1.0), you need
to downcast to a Controller, eg

((Controller)transformer) .setInitialTemplate("main");


cheers
--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@...
https://lists.sourceforge.net/lists/listinfo/saxon-help 

Re: XSLT2.0 for JDK 1.4

by booitc :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, i understood Michael & i did per his recommendation - i was just
sharing the other alternative which i discovered after, which achievs the
same end result.

> 2008/7/21  <booitc@...>:
>> Downcasting from javax.xml.transform.Transformer to
>> net.sf.saxon.Controller works. The following also works:
>>
>>  TransformerFactory factory = new TransformerFactoryImpl();
>>  Templates templates = factory.newTemplates(new
>> StreamSource(stylesheet));
>>  Transformer transformer = templates.newTransformer();
>>  transformer.transform(new StreamSource(source), new StreamResult(out));
>
> Mike meant to do XSLT 2.0 things such as setting the initial template
> (which aren't part of JAXP as that only supports XSLT 1.0), you need
> to downcast to a Controller, eg
>
> ((Controller)transformer) .setInitialTemplate("main");
>
>
> cheers
> --
> Andrew Welch
> http://andrewjwelch.com
> Kernow: http://kernowforsaxon.sf.net/
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
> world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> saxon-help@...
> https://lists.sourceforge.net/lists/listinfo/saxon-help
>



-------------------------------------------
South Africas premier free email service - www.webmail.co.za
------------------------------------------------------------------
For super low premiums, click here http://www.webmail.co.za/dd.pwm


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@...
https://lists.sourceforge.net/lists/listinfo/saxon-help