How to get the same behavior as xsl: value-of select in the onclick hyperlink attribute?

I have a problem with xsl, here is this:

<td onclick="location.href='/vakman/default.asp?name='" style="cursor:pointer" valign="top" height="100%"> 

After default.asp?name=' I need this value: <xsl:value-of select="veld[5]" />

Can someone help me with the correct notation?

UPDATE

Here is another code I'm using:

 <table border="0" align="right" cellspacing="4" cellpadding="0"> <xsl:for-each select="//regels/item"> <xsl:variable name="coor" select="veld[1]" /> <xsl:variable name="coor1" select="veld[2]" /> <xsl:variable name="naam" select="veld[5]"/> <xsl:value-of select="xsl:getKop()" disable-output-escaping="yes" /> <td onclick="location.href='/vakman/default.asp?naam='" style="cursor:pointer" valign="top" height="100%"> <table border="0" cellspacing="4" cellpadding="0" class="toppersTable" width="250px" height="75px"> <tr><td> <b> <xsl:value-of select="xsl:showOms(string(veld[5]))" /> <xsl:value-of select="xsl:showOms(string(veld[6]))" /></b><br /> <xsl:value-of select="xsl:showOms(string(veld[8]))" /><br /> <xsl:value-of select="xsl:showOms(string(veld[9]))" /> <xsl:value-of select="xsl:showOms(string(veld[10]))" /><br /> <xsl:value-of select="xsl:showOms(string(veld[11]))" /> </td></tr> </table> </td> <xsl:value-of select="xsl:getBottom()" disable-output-escaping="yes" /> <xsl:value-of select="$coor" /> <xsl:value-of select="$coor1" /> </xsl:for-each> </table> </table> 
+4
source share
2 answers

Using

 <td onclick="location.href='/vakman/default.asp?name={veld[5]}'" style="cursor:pointer" valign="top" height="100%"> 

The explanation . Using AVT (Attribute Templates) is recommended when the attribute name is statically known. This gives shorter and more readable code.

+3
source

Try using the xsl:attribute tag. you will get something like this:

 <td style="cursor:pointer" valign="top" height="100%"> <xsl:attribute name="onclick">location.href='/vakman/default.asp?name=<xsl:value-of select="veld[5]" />'</xsl:attribute> 
+1
source

Source: https://habr.com/ru/post/1345072/


All Articles