Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Cleaning up a string so I can output it

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 7/22/2009 12:09:00 PM
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/


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