Salut,

J'ai un pb de transformation d'un xml en java à l'aide d'un fichier xslt

Le code java qui transforme le xml en html est :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 
**
	 * Cette methode est utilisee pour transformer un XML en utilsant un XSL. xslFile indique le chemin en relatif 
	 * depuis le document root de la webapp, par ex:
	 * file://staticXML/file1.xsl
	 * 
	 * @param xslInput      : fichier xsl de tranformation
	 * @param node          : node a transformer en genrale la racine du document
	 * @param output        : la chaine de sortie
	 * @throws XMLException : gestion généralisée des exceptions par une classe dédiée
	 */	
	public static void xslTransform(InputStream xslInput, Node node,OutputStream output) throws XMLException
	{
		Log	loggeur	= LogServiceHelper.getLog("com.unilog.epshom.share.XMLUtils");
		loggeur.debug("Entree dans la methode de tranformation du xsl sans URIResolver");
 
		try
		{
			TransformerFactory.newInstance().newTransformer(
			new StreamSource(xslInput)).transform(new DOMSource(node),
			new StreamResult(output));
			loggeur.debug("Traitement effectué.");
		}
		catch (TransformerConfigurationException tce)
		{
			loggeur.error("TransformerConfigurationException la serialisation a échouée");
			throw new XMLException(tce);
 
		}
		catch (TransformerException te)
		{
			loggeur.error("TransformerException la serialisation a échouée");
			throw new XMLException(te);
		}
		finally
		{
			loggeur.debug("Sortie de xslTranform (InputStream, Node, OutputStream) sans URIResolver");
		}
	}
Le fichier xslt contient les lignes :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
 
<xsl:if test="ends-with( . , 'gif') or  ends-with( . , 'jpg') or ends-with( . , 'jpeg') or  ends-with( . , 'JPG') or  ends-with( . , 'GIF') or  ends-with( . , 'JPEG')" >
			 <img border="0">
				<xsl:attribute name="src"><xsl:value-of select="." /></xsl:attribute>
			</img>
        </xsl:if>
Sans le "if" le code ne plante pas mais si le fichier xsl contient le "if", ca plante.

L'erreur est la suivante :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
[2005-08-19 12:19:39,002] [TP-Processor1] ERROR DocumentXML  - Erreur lors de la transformation du fichier xml 
org.apache.xerces.validators.datatype.XMLException
	at com.unilog.epshom.share.XMLUtils.xslTransform(XMLUtils.java:137)
	at com.unilog.epshom.indexeur.Documents.DocumentXML.getContenuHTML(DocumentXML.java:176)
	at com.unilog.epshom.synthese.GestionDocuments.getContenu(GestionDocuments.java:67)
	at com.unilog.moteur.web.affiche.action.AfficherDetails.perform(AfficherDetails.java:70)
	at org.apache.struts.action.Action.execute(Action.java:420)
	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
	at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
	at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
	at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:300)
	at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:374)
	at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743)
	at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675)
	at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Unknown Source)



QQ'un a une idée?

Merci