I have a custom list with two columns. I want to use xsl to take the value of the fields in the first column, build a hyperlink and put it in the second column.
Please don't suggest calculated columns or lookup columns; I want to use xsl. This is what I have come up with; it doesn't give an error-page, but it doesn't do anything, either! Could somebody please help me?
<xsl:variable name="varFirstColumn">
<xsl:value-of select="@Column1" />
</xsl:variable>
<xsl:template match="FieldRef[@Name='Column2']" mode="Text_body">
<xsl:param name="thisNode" select="."/>
<a target="_blank">
<xsl:attribute name="class">myCSSclass</xsl:attribute>
<xsl:attribute name="href">mydomain.com/mysite/<xsl:value-of select="$varFirstColumn"/>.html</xsl:attribute>
MyTextHere</a>
</xsl:template>
I tried this, too:
<xsl:template match="FieldRef[@Name='Column2']" mode="Text_body">
<xsl:param name="thisNode" select="."/>
<a href="mydomain.com/mysite/mypage\{Column1}" target="_blank">Dir</a>
</xsl:template>
[edit]
I get an error saying The variable or parameter 'Column1' is either not defined or it is out of scope.. Now, Column1 is a Number column.
[update] The xsl does work if I don't try to look up the value of what is in Column1.
[a bit more info]
I am using a custom xsl file in the _layouts directory, and using the match to make changes to any column with that fieldref name. Both columns are in the same view and in the same list.