XSL e Sort

  • Thread starter Alessandro Benedetti
  • Start date
A

Alessandro Benedetti

Sto cercando di realizzare uno stylesheet che possa essere dinamicamente
ordinato (sort).

Il frammento di codice del file xsl è:

<xsl:param name="sortBy">LOTTO</xsl:param>
<xsl:param name="sortType" select="ascending"> </xsl:param>

........

<xsl:for-each select="DATAPREVAPPR_INT">

<xsl:sort select="node()[ name() = $sortBy] "
order="ascending" />
<tr>
<td>
<xsl:value-of select="LOTTO"/>
</td>

.....

La parte di codice della servlet che si occupa della trasformazione è:


String xslName = "/WEB-INF/xsl/DatePrevistaApprSQL.xsl";

try
{
URL stylesheetURL = getServletContext().getResource(xslName);


ByteArrayOutputStream baosHTML = new ByteArrayOutputStream();

TransformerFactory tFactory = TransformerFactory.newInstance();
TransformerFactory tFactory2 = TransformerFactory.newInstance();

Transformer transformer =
tFactory.newTransformer(new StreamSource(stylesheetURL.toString()));

********************cambio il parametro

transformer.setParameter("sortBy","DESCRIZIONE");


transformer.transform (
new StreamSource(new StringReader(xml)),
new StreamResult(baosHTML));

Il risultato non cambia!!!


Qualcuno può aiutarmi ???

Grazie.

Alessandro
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top