Click to See Complete Forum and Search --> : XSLT question regarding "linkfield param"


appaloosa
06-06-2008, 03:08 PM
I'm trying to add a little more logic to the following template named "drawcell" specifically to the param "linkfield" (top section of code). If a particular field DOCUMENT_URL contains "pubtest" I'd like the value to be <xsl:value-of select="MT[@N='DOCUMENT_URL']/@V"/> rather than "U", otherwise the value continues to be "U". I'm just not sure how to accomplish that as I'm quite new to XSLT.

<xsl:template name="drawcell">
<xsl:param name="meta"/>
<xsl:param name="linkfield"/>
<td valign="top">
<xsl:if test="$linkfield=$meta">
<xsl:text disable-output-escaping="yes">
&lt;a href="</xsl:text><xsl:value-of select="U"/>
<xsl:text disable-output-escaping="yes">"&gt;</xsl:text>
</xsl:if>

<xsl:when test="$meta = 'googledate'">
<xsl:text disable-output-escaping="yes">&lt;script&gt;write_reformat_date("</xsl:text>
<xsl:value-of select="MT[@N='DOC_DATE']/@V"/>
<xsl:text disable-output-escaping="yes">");&lt;/script&gt;</xsl:text>
</xsl:when>
<xsl:when test="$meta = 'DOC_DATE'">
<xsl:text disable-output-escaping="yes">&lt;script&gt;write_reformat_date("</xsl:text>
<xsl:value-of select="MT[@N='DOC_DATE']/@V"/>
<xsl:text disable-output-escaping="yes">");&lt;/script&gt;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="MT[@N=$meta]/@V"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="$linkfield=$meta">
<xsl:text disable-output-escaping="yes">&lt;/a&gt;</xsl:text>
</xsl:if>
</td>
</xsl:template>