Filtrer du xml avec un paramètre transmis par

3cp24 -  
 Nadia -
Bonjour,

je voudrais filtrer un document html grace à un fichier xsl en utilisant
une boucle dont le paramètre serait transmis par la servlet qui lance les feuille xml et xsl

<xsl: for each select= mon-paramètre>

Qu'est ce que je dois mettre dans ma servlet appelante pour transmettre le parametre ?

voici ma servlet:
<Code>

try
{
javax.xml.transform.TransformerFactory tFactory =
javax.xml.transform.TransformerFactory.newInstance();
//get the real path for xml and xsl files.
//String ctx = getServletContext().getRealPath("Tomcat5028\\webapps\\ROOT\\xml") ; //+ FS;
// Get the XML input document and the stylesheet, both in the servlet
// engine document directory.
// String protocol, String host, int port, String file)
javax.xml.transform.Source xmlSource =
new javax.xml.transform.stream.StreamSource
(new java.net.URL("http","localhost",8090, "/xml/ex_cours.xml").openStream() );
/*
URL(String protocol, String host, int port, String file)
Creates a URL object from the specified protocol, host, port number, and file.
*/
javax.xml.transform.Source xslSource =
new javax.xml.transform.stream.StreamSource
(new java.net.URL("http","localhost",8090, "/xsl/ex_cours.xsl").openStream());
// Generate the transformer.
javax.xml.transform.Transformer transformer =
tFactory.newTransformer(xslSource);
// Perform the transformation, sending the output to the response.
transformer.transform(xmlSource,
new javax.xml.transform.stream.StreamResult(out));
}


si quelqu'un connait l'instruction pour transmettre un parametre à mon fichier xsl pour réaliser mon filtre, merci de me répondre :)
A voir également:

1 réponse

Nadia
 
Coté Java :
transformer.setParameter("nomDeVariable", "valeurDeVariable");

côté xsl :
<xsl:param name="nomDeVariable"/>
0