Uwe,
Thanks for responding. I think I'm starting to get it. What I'm a
little confused about is the necessity to call the TurbineXSLT service
from within some java code - in your example a tool. It looks like the
transform method (of what class?) is a thin wrapper around the
TurbineXSLT service. I assumed going into this that the TurbineXSLT
service (or any service) would be available using Velocity.
In your example I have two questions (and now you will see what a noobie
I really am :) ).
1) where did $session come from?
2) once I've made the call from a template then how do I use it?
Presumably the string will be fully formed HTML output, so it wouldn't
really do to make it part of an existing template which would generate
it's own head, body etc.
I hope these questions are clear.
Thanks,
Dan
[EMAIL PROTECTED] wrote:
>Hi Dan
>
>Here�s a little method using the XSLTService, that I have added to
>a tool I am using:
>
> /**
> * Transforms a given xml schema using the given xsl schema
> * and returns the result as a string. So it can be used
> * in a velocity template as $session.transform("test.xml","test.xsl")
> * @param xml name of xml file
> * @param xsl name of xsl file
> * @return String of rendered output
> */
> public String transform(String xml, String xsl)
> {
> String result = null;
> try {
> TurbineXSLT xslt = new TurbineXSLT();
>
> Reader r = new FileReader(xml);
>
> result = xslt.transform(xsl,r);
>
> r.close();
> }
> catch (Exception e) {
> Log.error(e);
> }
>
> if (result == null)
> result = "<font color=\"red\">Error converting file" + xml +
>"</font>";
>
> return result;
> }
>
>Hope that helps
>
>Uwe
>
>
>
>--
>To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>