Click to See Complete Forum and Search --> : building a hyperlink with xslt


jeepzy3
09-30-2003, 01:44 PM
I am attempting to build a dynmic hyperlink. Within my xslt, I pass a string to a java pgm and it returns the ID. I would like to use this returned value in a hyperlink. My xslt looks something like this:

<xsl:variable name="moFilePath" select="GENERIC-CONTENT/FILE-ATTACH" />
<xsl:variable name="thisID" select="java:getFileMO($helper,$moFilePath)" />

<a href="/AppConsole/secure/cmaViewer.do?spfAId=$thisID">
<xsl:value-of select="$moFilePath" />
</a>

When I do a view source of the page, I get the following:
<a href="/AppConsole/secure/cmaViewer.do?spfAId=$thisID"></a>

The $thisID and $moFilePath don't get translated.

The java pgm does return the correct ID. I have displayed this on the page and now moving on to the part to build the URL.

jeepzy3
09-30-2003, 02:38 PM
Of course I found a good example minutes after I posted my problem.

In case anyone else looks at this and needs the answer:

<xsl:variable name="moFilePath" select="GENERIC-CONTENT/FILE-ATTACH" />
<xsl:variable name="thisID" select="java:getFileMO($helper,$moFilePath)" />
<a>
<xsl:attribute name="href">/AppConsole/secure/cmaViewer.do?spfAId=<xsl:value-of select="java:getFileMO($helper,$moFilePath)"/>
</xsl:attribute>
<xsl:value-of select="$moFilePath" />
</a>

I was also referencing the wrong xml so that's why $moFilePath was displaying nothing.

My new output is as expected:
<a href="/AppConsole/secure/cmaViewer.do?spfAId=1234567890STFL">/File Attachments/xxx.doc</a>