Note that there are some explanatory texts on larger screens.

plurals
  1. POxsl generation of html table wirh a button for every row
    text
    copied!<p>i have a problem and i hope somebody can help me.</p> <p>Here is a shortened part of my xsl file.</p> <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt; &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:con="http://eviware.com/soapui/config"&gt; &lt;xsl:output method="html" indent="yes" encoding="UTF-8"/&gt; &lt;xsl:template match="/"&gt; &lt;html&gt; &lt;head&gt; &lt;script type="text/javascript"&gt; function anAus(id) { if (document.getElementById(id).style.display == 'none') { document.getElementById(id).style.display = 'block'; } else { document.getElementById(id).style.display = 'none';} } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;TABLE border="1"&gt; &lt;thead&gt; &lt;TH&gt;[ id ]&lt;/TH&gt; &lt;TH&gt;[ name ]&lt;/TH&gt; &lt;TH&gt;[ aktiv ]&lt;/TH&gt; &lt;TH&gt;[ result ]&lt;/TH&gt; &lt;TH&gt;[ help ]&lt;/TH&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;xsl:for-each select="....." &gt; &lt;TR&gt; &lt;TD&gt;&lt;xsl:value-of select="ID" /&gt;&lt;/TD&gt; &lt;TD&gt;&lt;xsl:value-of select="name" /&gt;&lt;/TD&gt; &lt;TD&gt; &lt;xsl:value-of select="@activated" /&gt;&lt;/TD&gt; &lt;TD&gt;&lt;xsl:value-of select="result" /&gt;&lt;/TD&gt; &lt;!-- column 5 --- Button --&gt; &lt;xsl:variable name="button_name" select="concat('Button_',$ID)"/&gt; &lt;xsl:variable name="button_variable" select="concat('but_var',$ID)"/&gt; &lt;TD width="50" align="center"&gt;&lt;input name="$button_name" Type="button" value="help" onClick="javascript:anAus('$button_variable')"/&gt;&lt;/TD&gt; &lt;/TR&gt; &lt;TR id="$button_variable" style="display:none"&gt; &lt;TD colspan="5" &gt; &lt;xsl:value-of select = "$verbesserung" /&gt;&lt;/TD&gt; &lt;/TR&gt; &lt;/tbody&gt; &lt;/TABLE&gt; </code></pre> <p>Now the explanation of my problem:</p> <p>For each element i generate a row in a html table. Every row has 5 cells. In the last cell is a button, which can expand a help row for the element.</p> <p>up to now i used a java.script function, that use the elementID of the row-obejct to change the visibility.</p> <p>i try to generate the button name and objectid by the element id and a string in a concat operator. but in my result table every button has the same function, only to expand the "helprow" under the first entry-row.</p> <p>i tried to give out the "$button_name" and "$button_variable" for each entry and they are correct. can someone find the mistake in the code.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload