Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Cleaning up a string so I can output it

From: Dylan <mejari@-----.--->
To: 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.
&lt;true&gt; expected but was
&lt;&quot;Actions Test Asset not found in search&quot;&gt;.
(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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent