[ProgSoc] how to pass a value from xsl to jsp

Tomislav Bozic tomchristmas at progsoc.org
Thu May 12 13:46:05 EST 2011


> Hi, all. Anybody knows how to pass a variable from xsl to jsp?
> In my case, I have a bunch of links. And every time you click a link, it
> will redirect you to a jsp file, and also pass a variable  which I can use
> later on.
>
> what I wrote was like this:
>
> <xsl:variable name="param" select="aUrl"/>
> <a href="a.jsp?url={$param}">click me</a>
>
>
> But it isnt working. It redirect to "a.jsp?url="
> Any ideas? Thanks.

Without having your XML in front of me, I can't be certain, but I think
you might want to do something along the lines of:

<xsl:for-each select="linkset">
<a>
<xsl:attribute name="href">
a.jsp?url=<xsl:value-of select="link" />
</xsl:attribute>
click me
</a>
</xsl:for-each>

presuming that your XML looks something like this:

<linkset>
  <link>http://www.example.com</link>
  <link>http://www.example.edu</link>
  <link>http://www.example.org</link>
  .
  .
  .
</linkset>

What a horrid language XSLT is :P

Tom




More information about the Progsoc mailing list