Subject:replacing Author:David Corley Date:18 Jan 2007 09:29 AM Originally Posted: 18 Jan 2007 09:27 AM
I have a java stack-trace string that I'd like to format for html display.
I need to replace every " at" sub-string of the stack-trace with " at".
I initially used the xpath 2.0 replace() function, but as Michael Kay's book pointed out, the replace function doesn't support output escaping. So what happens is my html CODE is beautifully formatted, but is not rendered the way I want it.
I need the the 
 to actually be visible in the code, as opposed to being processed as a new line by the xslt processor, which is what currently happens.
Subject:replacing Author:Tony Lavinio Date:18 Jan 2007 11:10 AM
Why don't you post what you have for input XML, and also the XSLT
you've tried? Otherwise, we're just guessing, and may waste time
suggesting things you've already tried.
Also, without a test case showing input, it's hard to know what's
actually being transformed.
Subject:replacing Author:David Corley Date:19 Jan 2007 03:40 AM
First of all apologies for the multiple threads. I've been posting this problem on a few regex/xslt forums, and genuinely forgot I had already posted.
The input I have is the following:
<testsuite>
<testcase classname="test.net.sourceforge.pmd.jsp.rules.DontNestJsfInJstlIterationTest" name="testViolation" time="0.0">
<error message="Couldn't find xml/DontNestJsfInJstlIteration.xml" type="java.lang.RuntimeException">java.lang.RuntimeException: Couldn't find xml/DontNestJsfInJstlIteration.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.jsp.rules.DontNestJsfInJstlIterationTest.testViolation(DontNestJsfInJstlIterationTest.java:20)
</error>
</testcase>
</testsuite>
My xslt needs to take the text between the <error> tags and output it to html with inserting before every instance of the word "at".
I've tried the following:
<td class="stacktrace"><xsl:value-of select="replace(.,'at',' at')"></xsl:value-of></td>
Unfortunately the xslt processer interprets the 
 as a processing instruction, rather than text for output, and the html code get formatted using the instruction. I've tried turning the "disable-output-escaping" attribute on in the <xsl:value-of> element, but it has no effect.