Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Cleaning up a string so I can output it >Thread Next - Re: Cleaning up a string so I can output it Re: Cleaning up a string so I can output itTo: NULL Date: 7/22/2009 3:44:00 PM On Jul 22, 3:09 am, Martin Honnen <mahotr...@yahoo.de> wrote:
> Dylan wrote:
> > Here's the relevant code:
>
> > <tr>
> > <xsl:variable name="testname" select="substring-after
> > (@name,'test_')" />
> > <xsl:variable name="testresult" select="failure "/>
> > <td><xsl:value-of select="$testname"/></td>
> > <td />
> > <td onclick="document.getElementById
> > ('results').innerHTML='{$testresult}'"><a name="{$testname}"
> > class="info" href="#{$testname}"><xsl:value-of select="failure/
> > @message"/><span><xsl:value-of select="failure"/></span></a></td>
> > </tr>
>
> > and then farther down the page:
>
> > <td>
> > <span id="results">Click on an error or failure and its details
> > will be printed here</span>
> > </td>
>
> > The "<xsl:value-of select="failure"/>" "<span><xsl:value-of
> > select="failure"/></span>" works to get the data for the popup, but
> > the "<xsl:variable name="testresult" select="failure "/>" followed by
> > "innerHTML='{$testresult}'" doesn't.
>
> Can you show us how such a failure element in your XML input looks? Can
> you explain what exactly happens when you say "doesn't work"? Do you get
> a script error?
>
> And why are you setting innerHTML? Shouldn't you set innerText for IE
> and textContent for other browsers? xsl:value-of select="failure" will
> create a text node while settings innerHTML parses as HTML so it is no
> surprise if you get different results.
>
> --
>
> Martin Honnen --- MVP XML
> http://msmvps.com/blogs/martin_honnen/
Here is an example failure element:
<testcase name="test_Actions" time="39" assertions="1">
<failure type="Test::Unit::AssertionFailedError" message="Failed:
Actions Test Asset not found in search....">
Failed: Actions Test Asset not found in search.
<true> expected but was
<"Actions Test Asset not found in search">.
(Test::Unit::AssertionFailedError)
P:/Tests/RunAll/deciphertest.rb:90:in `test_Actions' </failure>
</testcase>
What happens when I click on the appropriate error is, well, nothing.
Nothing on screen changes, the text that is in place that is supposed
to change is the same as it was before. When I set the variable to
something smaller and without any special characters (the test name,
for example), it works exactly like I intend it to and the text within
the <span id="results"></span> tags changes to the name of the test.
When I replace that variable with the one holding the entire test
results, it doesn't do anything. Also, this exact text is correctly
displayed in the popup.
I'm using innerHTML because that was the code I found when I was
looking around to see if anyone had done anything like this. Also, my
original plan was to create a <textarea> that the text would go in,
but I thought that it might have been the problem so I removed it. I
just went and tried it with innerText (I'm using IE) instead and
received the exact same results (or lack thereof).
-Dylan
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
