building a hyperlink with xslt
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.
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>
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks