Sure it is. There's a substring() function in XPath, which is used in XSLT. There's also substring-after() and substring-before().
Although I'm not sure what you mean when you say "in java file", which you said twice. You do know that XSLT can only be used to transform XML, don't you? Your question sounds like you want to do something to Java source code using XSLT.
posted 9 years ago
Actually my requirement is something like this:
I have a java file with a lot of substring methods in it. Basically I am trying to reduce those substring functions as those will make my program hard to read and involves more complexity.
For this reason, I am planning to change to xsl/xslt because I remember someone told me that this could be done using xslt. Now the question is how we can achieve it using xslt. What are the things need to be pre-written? Any good tutorial that you can suggest? Thanks
Okay. So you have some Java source code with lots of substring operations? And you plan to throw away that code and use XSLT instead? Is that what you are saying?
If so, then sure, go ahead and do that. I don't understand what you mean by "pre-written" but if you're asking what XSLT code you should use for a task that you haven't described at all, then I don't understand how you expect anybody could provide any answers for that.
If you google for "XSLT tutorial" you'll get a link to the w3schools pages about XSLT which are not very good at all. I don't recommend learning an entire language by reading Internet tutorials. Get a book and start there. Good luck with your project and if you have a specific problem with some XSLT code then don't hesitate to come here and ask it.
posted 9 years ago
Thanks for your reply. I will definitely google out for some books on XSLT tutorial and then will come back if I have any specific doubts. Appreciate your help.