Subject:Formatting of java stacktrace using xslt (but no regex preferably) Author:David Corley Date:17 Jan 2007 11:01 AM
Hey all,
I have a string that I need to format using xslt 2.0.
The string is a java stacktrace error, that looks like this:
java.lang.RuntimeException: Couldn't find xml/UselessStringValueOf.xml at test.net.sourceforge.pmd.testframework.RuleTst.extractTestsFromXml(RuleTst.java:149) at test.net.sourceforge.pmd.testframework.RuleTst.extractTestsFromXml(RuleTst.java:137) at test.net.sourceforge.pmd.testframework.SimpleAggregatorTst.runTests(SimpleAggregatorTst.java:18) at test.net.sourceforge.pmd.rules.strings.UselessStringValueOfTest.testAll(UselessStringValueOfTest.java:16)
At the moment, it's one long line. I'd like to insert a carraige return after every " at " in the string, so it's nicely formatted. The stack-traces will be of varying lengths.
Can anyone suggest a method for doing this?
Subject:Formatting of java stacktrace using xslt (but no regex preferably) Author:David Corley Date:18 Jan 2007 02:58 AM
I'm afraid not. replace() outputs the result as strings, as opposed to markup, so the html code has perfectly formatted the text, but the rendered text is exactly the same. The xpath programmers reference says to use the analyse-string xslt command to allow output of escaping characters.