aspose file tools*
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
Author

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">
<xsl:apply-templates/>
</xsl:for-each>
</td>
<td align="right">
<xsl:for-each select="productId">
<xsl:apply-templates/>
</xsl:for-each>
</td>
<td align="right">
<xsl:for-each select="amount">
<xsl:apply-templates/>
</xsl:for-each>
</td><td><a href="deleteDetail.do?invoiceId=<PARAMETER 1>&productId=<PARAMETER 2>">Delete</a></td>
Thanks in advance.
Cristian.
Mapraputa Is
Leverager of our synergies
Sheriff

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="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="invoiceId">1234</xsl:param>
<xsl:param name="productId">4321</xsl:param>
<xslutput method="html"/>
<xsl:template match="/">
<a href="deleteDetail.do?invoiceId={$invoiceId}&amp;productId={$productId}">Delete</a>
</xsl:template>
</xsl:stylesheet>
 
 
subject: Problem with XSL.