File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes Problem with XSL. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Problem with XSL." Watch "Problem with XSL." New topic

Problem with XSL.

Cristian Cardenas
Ranch Hand

Joined: Jan 29, 2002
Posts: 50
I'm using XSL to create a table with the details of one invoice, and I need to put an href in each row with two parameters (invoiceId, and productId) to the servlet which is going to do the row delete. I can find the way to generate the URL, because I can't concatenate the parameters to the rest of the URL. The code is like the following one.
<td align="right">
<xsl:for-each select="invoiceId">
<td align="right">
<xsl:for-each select="productId">
<td align="right">
<xsl:for-each select="amount">
</td><td><a href="<PARAMETER 1>&productId=<PARAMETER 2>">Delete</a></td>
Thanks in advance.
Mapraputa Is
Leverager of our synergies

Joined: Aug 26, 2000
Posts: 10065
You can declare your invoiceId, and productId as parameters:
<xsl:param name="invoiceId">1234</xsl:param>
<xsl:param name="productId">4321</xsl:param>
(here I put default values, but you can pass them to your XSLT)
and then use an attribute-value template {$parameter-name}to read parameter values:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="">
<xsl:param name="invoiceId">1234</xsl:param>
<xsl:param name="productId">4321</xsl:param>
<xslutput method="html"/>
<xsl:template match="/">
<a href="{$invoiceId}&amp;productId={$productId}">Delete</a>
I agree. Here's the link:
subject: Problem with XSL.
jQuery in Action, 3rd edition