-
1. Re: trying to use xslt in a camel route....
davsclaus Jan 15, 2013 4:19 AM (in response to e0richt)Hi
Do you want to store the .xslt file in the classpath, eg inside the JAR of your application. Or do you want to store the file externally on the file system?
For example
.to("xslt:file:./AddProperties.xslt")
This means to load the file from the home dir where you started the application, as you start with a dot.
How do you run this application? Do you use Fuse ESB or something else?
-
2. Re: trying to use xslt in a camel route....
e0richt Jan 15, 2013 3:36 PM (in response to davsclaus)ok, because I was using java dsl in order to add the xslt template to my route, I was able to do:
File f = new File(".");
logger.info("path="+f.getAbsolute());
which does show the base address for my fuse installation and based on that was able to do the following:
.to("xslt:file://"f.getAbsolute()"/etc/myxslt.xsl")
.to(....)
that seems to work because I don't get the "file not found" error anymore....
however, my new problem is that I can't seem to get the darn file to actually transform the message. I don't get any error messages, Im not able to use the <xsl:message> to get any information. However, I did inadvertently add an error while playing with the stylesheet which confirms what file it is using...
any ideas on how to debug the stylesheet?
-
3. Re: trying to use xslt in a camel route....
davsclaus Jan 16, 2013 2:25 AM (in response to e0richt)Hi
You can enable the tracer
http://camel.apache.org/tracer
Which logs the message flow in Camel to the log file.
I would suggest to create a simple unit test and run it outside Fuse ESB to see if you can get it working. Then when you got the routes + xslt working, you can package that and run in the ESB.
-
4. Re: trying to use xslt in a camel route....
e0richt Jan 16, 2013 11:46 AM (in response to davsclaus)hi,
yup, know about the camel tracer, not using it because of performance issues but
I do have a processor before and after the xslt transform where they do echo out the in part of the exchange. (i.e. ex.getIn().getBody(String.class) )
so I know what I am getting in before the xslt and what the input is for the next processor (which is the same)....
as far as unit test: I have tried the xslt code in one of the online tools and it works there...
I also tried to setup a processor which instantiates an XsltBuilder object to work with directly which should return some sort of exception assuming an error is found... (it doesn't and it also does the same thing as the other approach so its at least consistent, I guess)...
not sure why there isn't some sort of accomodation for the trace messages that would be output by the processor (or if there is I haven't seen any info on it...)
I am about to try not using a file but getting the "string" and send that into the builder object and see what happens there; because I have a example which does something like that and it seems to work...