Tomcat 5.5 Xml + Xslt Question

2007-02-14 Thread Jim Reynolds

Hello,
I am struggling with content types within a JSP page. I have an XML,
XSLT and CSS file that combined are suposed to create a tree. (I am
trying to get treeview to work).

I created a webapp for playing in, and have the following code in a
jsp page called showTree.jsp.

But when I hit the page, it shows nothing and has text/html as the
content-type, Then I tried text/xml with the same results.

I have never used xml and xslt in a browser and was hoping someone may
give me some advise?

Thanks,



[jsp]
?xml version=1.0 encoding=UTF-8?
?xml-stylesheet type=text/css href=treeview/treeview.css ?
?xml-stylesheet type=text/xsl href=treeview/treeview.xslt ?

treeview title=Windows XP Explorer Treview
folder title=My documents img=MyDocuments.gif
folder title=House img=folder.gif
leaf title=What\'s going on? code=1 
img=ie_link.gif/
leaf title=What\'s up? code=1 img=question.gif/
leaf title=Why you should hire me? code=1 
img=question.gif/
/folder
folder title=My images img=MyImages.gif
leaf title=funny code=1 img=red_ball.gif/
leaf title=ounga ounga code=1 img=red_ball.gif/
/folder
/folder
folder title=My computer img=computer.gif
folder title=Floppy (A:) code=1 img=floppy.gif/
folder title=Hard drive (C:) code=1 img=harddrive.gif
leaf title=Linux code=1 img=folder.gif/
leaf title=Open source code=1 img=folder.gif/
leaf title=Freedom code=1 img=folder.gif/
/folder
leaf title=Configuration Pannel code=1 img=config.gif/
leaf title=Shared documents code=1 img=folder.gif/
/folder
folder title=Network img=network.gif/
folder title=Trash img=trash.gif/
/treeview

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat 5.5 Xml + Xslt Question

2007-02-14 Thread APliszka-Public
1. In your jsp make sure that '?xml version=1.0 encoding=UTF-8?' 
is on the very first line, it should be befora any imports or taglibs or 
etc.


This is just one of the problems you might have with xml in jsps.

Andrew

Jim Reynolds wrote:


Hello,
I am struggling with content types within a JSP page. I have an XML,
XSLT and CSS file that combined are suposed to create a tree. (I am
trying to get treeview to work).

I created a webapp for playing in, and have the following code in a
jsp page called showTree.jsp.

But when I hit the page, it shows nothing and has text/html as the
content-type, Then I tried text/xml with the same results.

I have never used xml and xslt in a browser and was hoping someone may
give me some advise?

Thanks,



[jsp]
?xml version=1.0 encoding=UTF-8?
?xml-stylesheet type=text/css href=treeview/treeview.css ?
?xml-stylesheet type=text/xsl href=treeview/treeview.xslt ?

treeview title=Windows XP Explorer Treview
folder title=My documents img=MyDocuments.gif
folder title=House img=folder.gif
leaf title=What\'s going on? code=1 img=ie_link.gif/
leaf title=What\'s up? code=1 img=question.gif/
leaf title=Why you should hire me? code=1 
img=question.gif/

/folder
folder title=My images img=MyImages.gif
leaf title=funny code=1 img=red_ball.gif/
leaf title=ounga ounga code=1 img=red_ball.gif/
/folder
/folder
folder title=My computer img=computer.gif
folder title=Floppy (A:) code=1 img=floppy.gif/
folder title=Hard drive (C:) code=1 img=harddrive.gif
leaf title=Linux code=1 img=folder.gif/
leaf title=Open source code=1 img=folder.gif/
leaf title=Freedom code=1 img=folder.gif/
/folder
leaf title=Configuration Pannel code=1 img=config.gif/
leaf title=Shared documents code=1 img=folder.gif/
/folder
folder title=Network img=network.gif/
folder title=Trash img=trash.gif/
/treeview

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat 5.5 Xml + Xslt Question

2007-02-14 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jim,

Jim Reynolds wrote:
 I am struggling with content types within a JSP page. I have an XML,
 XSLT and CSS file that combined are suposed to create a tree. (I am
 trying to get treeview to work).

I don't know a thing about treeview, but I might be able to help with
some other issues.

 ?xml version=1.0 encoding=UTF-8?
 ?xml-stylesheet type=text/css href=treeview/treeview.css ?

You don't want this: xml-stylesheet is for XSLTs only, not CSS files. If
you want to include a CSS file with your web page, you're going to have
to make sure that the (HTML) content emitted to the browser contains a
link rel=stylesheet href=treeview/treeview.css / element.

 ?xml-stylesheet type=text/xsl href=treeview/treeview.xslt ?

This directive will instruct the browser to transform the current
document (the one for which you provided the source) using
treeview/treeview.xslt.

JSP will not automatically transform your XML document, but the browser
should. It will download the XSLT and transform your document -- I
assume into HTML. I can't tell what your XSLT does.

In terms of the CSS stylesheet, your XSLT should probably emit the
link element required to get the browser to use that stylesheet.

I recommend that you take a step back.

Take the file you posted, along with the CSS And XSLT files, ad just try
to get it working on your local machine. There's no need to have a web
server and JSP runner confusing things.

Mozilla Firefox (and I think MSIE) will transform your XML document if
you just load it right off your local disk. Once that's working, /then/
you can throw JSP into the mix and start generating dynamic XML to be
transformed.

Some more free advice: if you want to do XSLT transformations, don't
rely on the browser to do them properly. I've seen some weird stuff when
ff transforms XML, sometimes resulting in errors which make the page
unusable. Also, you can never detect errors that occur in the browser,
so you might never know anything is wrong unless you get angry calls
from customers.

I highly recommend Cocoon, which was designed to do nothing but
transform XML using easily defined pipelines that can do some amazing
things.

Just me $0.02.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF04L/9CaO5/Lv0PARAlqBAJ4tFfLDHN6R/9r6/Tfe2sN4RUUbBQCeOSvX
OY5338UknX5KcEeqOm7ymvQ=
=QMkV
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat 5.5 Xml + Xslt Question

2007-02-14 Thread Jim Reynolds

Problem resolved:

Thank you for the reply. I was setting my @page content to text/xml on
line1, then the ?xml tag on the second line. Hard to believe that
would screw things up, but it does.

Thanks a million, saved me a lot of time.

Regards.





On 2/14/07, APliszka-Public [EMAIL PROTECTED] wrote:

1. In your jsp make sure that '?xml version=1.0 encoding=UTF-8?'
is on the very first line, it should be befora any imports or taglibs or
etc.

This is just one of the problems you might have with xml in jsps.

Andrew

Jim Reynolds wrote:

 Hello,
 I am struggling with content types within a JSP page. I have an XML,
 XSLT and CSS file that combined are suposed to create a tree. (I am
 trying to get treeview to work).

 I created a webapp for playing in, and have the following code in a
 jsp page called showTree.jsp.

 But when I hit the page, it shows nothing and has text/html as the
 content-type, Then I tried text/xml with the same results.

 I have never used xml and xslt in a browser and was hoping someone may
 give me some advise?

 Thanks,



 [jsp]
 ?xml version=1.0 encoding=UTF-8?
 ?xml-stylesheet type=text/css href=treeview/treeview.css ?
 ?xml-stylesheet type=text/xsl href=treeview/treeview.xslt ?

 treeview title=Windows XP Explorer Treview
 folder title=My documents img=MyDocuments.gif
 folder title=House img=folder.gif
 leaf title=What\'s going on? code=1 img=ie_link.gif/
 leaf title=What\'s up? code=1 img=question.gif/
 leaf title=Why you should hire me? code=1
 img=question.gif/
 /folder
 folder title=My images img=MyImages.gif
 leaf title=funny code=1 img=red_ball.gif/
 leaf title=ounga ounga code=1 img=red_ball.gif/
 /folder
 /folder
 folder title=My computer img=computer.gif
 folder title=Floppy (A:) code=1 img=floppy.gif/
 folder title=Hard drive (C:) code=1 img=harddrive.gif
 leaf title=Linux code=1 img=folder.gif/
 leaf title=Open source code=1 img=folder.gif/
 leaf title=Freedom code=1 img=folder.gif/
 /folder
 leaf title=Configuration Pannel code=1 img=config.gif/
 leaf title=Shared documents code=1 img=folder.gif/
 /folder
 folder title=Network img=network.gif/
 folder title=Trash img=trash.gif/
 /treeview

 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]






-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: tomcat and xslt 2.0

2006-03-01 Thread Zohar Amir

I've tried putting it right before TransformerFactory.newInstance() .
now, when I invoke the transform method I get NPE at 
net.sf.saxon.Controller.transform(Controller.java:1319)

Any help?

- Original Message - 
From: Zohar Amir [EMAIL PROTECTED]
To: Tomcat Users List users@tomcat.apache.org; Richard Toren 
[EMAIL PROTECTED]

Sent: Wednesday, March 01, 2006 9:25 AM
Subject: Re: tomcat and xslt 2.0



Thanks.
Where do I put the System.setProperty(...)?

- Original Message - 
From: Richard Toren [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, February 27, 2006 7:28 PM
Subject: Re: tomcat and xslt 2.0


I think there are not that many xslt 2.0 engines out there to choose from. 
In any case saxon is xslt 2.0 and very fast.  You have to include the
jar (obvious, but) and before you instantiate a TransformerFactory 
set the System property:


System.setProperty( javax.xml.transform.TransformerFactory, 
net.sf.saxon.TransformerFactoryImpl);


You will get a warning if the xslt is 1.0, but it will still compile and 
function.


Richard Toren

Zohar Amir wrote:

Correct me if I'm wrong here: as I understand it, tomcat uses Xalan as 
its XSLT engine. Xalan does not support XSLT 2.0 .
Is there any other XSLT engine I can use with tomcat (I read something 
about Saxon)? If so, how do I do that?

Thanks,
Zohar.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: tomcat and xslt 2.0

2006-03-01 Thread Richard Toren

Sorry, I've been too busy or scatter brained to check here.

I use jdom and invoke  this as:

System.setProperty(javax.xml.transform.TransformerFactory, 
net.sf.saxon.TransformerFactoryImpl);

trans = new XSLTransformer( new FileInputStream( mytransform ));

I think that you have to request this before you request the 
TransformerFactory then cast the
TransformerFactory to a SAXTransformerFactory before creating the 
Templates object.  I sort of do this step out of force of habit and I'm 
not sure it is absolutely necessary (I think not).


As to the NPE, when saxon does the initial parse of the xslt it reports 
errors, which is a good thing since I write most
of my xslt in emacs.   If the xslt doesn't compile you will get an NPE, 
but that doesn't mean that's your problem in this case.  Make sure you 
are logging  your exceptions. 


Wish I could be more helpful

Richard

Zohar Amir wrote:


I've tried putting it right before TransformerFactory.newInstance() .
now, when I invoke the transform method I get NPE at 
net.sf.saxon.Controller.transform(Controller.java:1319)

Any help?

- Original Message - From: Zohar Amir [EMAIL PROTECTED]
To: Tomcat Users List users@tomcat.apache.org; Richard Toren 
[EMAIL PROTECTED]

Sent: Wednesday, March 01, 2006 9:25 AM
Subject: Re: tomcat and xslt 2.0



Thanks.
Where do I put the System.setProperty(...)?

- Original Message - From: Richard Toren 
[EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, February 27, 2006 7:28 PM
Subject: Re: tomcat and xslt 2.0


I think there are not that many xslt 2.0 engines out there to choose 
from. In any case saxon is xslt 2.0 and very fast.  You have to 
include the
jar (obvious, but) and before you instantiate a 
TransformerFactory set the System property:


System.setProperty( javax.xml.transform.TransformerFactory, 
net.sf.saxon.TransformerFactoryImpl);


You will get a warning if the xslt is 1.0, but it will still compile 
and function.


Richard Toren

Zohar Amir wrote:

Correct me if I'm wrong here: as I understand it, tomcat uses Xalan 
as its XSLT engine. Xalan does not support XSLT 2.0 .
Is there any other XSLT engine I can use with tomcat (I read 
something about Saxon)? If so, how do I do that?

Thanks,
Zohar.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: tomcat and xslt 2.0

2006-02-28 Thread Zohar Amir

Thanks.
Where do I put the System.setProperty(...)?

- Original Message - 
From: Richard Toren [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, February 27, 2006 7:28 PM
Subject: Re: tomcat and xslt 2.0


I think there are not that many xslt 2.0 engines out there to choose from. 
In any case saxon is xslt 2.0 and very fast.  You have to include the
jar (obvious, but) and before you instantiate a TransformerFactory set 
the System property:


System.setProperty( javax.xml.transform.TransformerFactory, 
net.sf.saxon.TransformerFactoryImpl);


You will get a warning if the xslt is 1.0, but it will still compile and 
function.


Richard Toren

Zohar Amir wrote:

Correct me if I'm wrong here: as I understand it, tomcat uses Xalan as 
its XSLT engine. Xalan does not support XSLT 2.0 .
Is there any other XSLT engine I can use with tomcat (I read something 
about Saxon)? If so, how do I do that?

Thanks,
Zohar.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: tomcat and xslt 2.0

2006-02-27 Thread Richard Toren
I think there are not that many xslt 2.0 engines out there to choose 
from. In any case saxon is xslt 2.0 and very fast.  You have to include the
jar (obvious, but) and before you instantiate a TransformerFactory 
set the System property:


System.setProperty( javax.xml.transform.TransformerFactory, 
net.sf.saxon.TransformerFactoryImpl);


You will get a warning if the xslt is 1.0, but it will still compile and 
function.


Richard Toren

Zohar Amir wrote:

Correct me if I'm wrong here: as I understand it, tomcat uses Xalan as 
its XSLT engine. Xalan does not support XSLT 2.0 .
Is there any other XSLT engine I can use with tomcat (I read something 
about Saxon)? If so, how do I do that?

Thanks,
Zohar.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



xslt

2006-02-22 Thread Zohar Amir

Can I use XSLT 2.0 stylesheets with tomcat 5.5.15 ? I get:
ERROR:  'Error checking type of the expression 'funcall(format-dateTime, 
[step(child, 24), literal-expr([Mn] [D1o], [Y0001] at [h01]:[m09]:[s02] 
[P])])'.'


Thanks,
Zohar. 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



tomcat and xslt 2.0

2006-02-22 Thread Zohar Amir
Correct me if I'm wrong here: as I understand it, tomcat uses Xalan as its 
XSLT engine. Xalan does not support XSLT 2.0 .
Is there any other XSLT engine I can use with tomcat (I read something about 
Saxon)? If so, how do I do that?

Thanks,
Zohar. 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]