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

bangdao hu bangdao.hu at gmail.com
Thu May 12 21:44:40 EST 2011


Thanks, Tom and Chris.  I used
<xsl:variable name="param" >aURL</xsl:variable >
  <a href="a.jsp?url={$param}">
click me</a>

And now it works fine.....


On Thu, May 12, 2011 at 1:46 PM, Tomislav Bozic <tomchristmas at progsoc.org>wrote:

>
> > 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
>
>


-- 
Best regards

Bangdao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://progsoc.org/pipermail/progsoc/attachments/20110512/46dc2eb6/attachment.html>


More information about the Progsoc mailing list