Bonjour, j'ai un fichier xml disposé ainsi :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
 
<ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<info>
<formats>
  <item ID="YB1.36LT">
  <title ln="en" Value="Carton Can 1.36lt" /> 
  <title ln="fr" Value="Carton Can 1.36lt" /> 
  </item>
  <item ID="YC1.2LT">
  <title ln="en" Value="Can 1.2 lt" /> 
  <title ln="fr" Value="Can 1.2 lt" /> 
  </item>
  .......
à l'aide d'un fichier XSLT, j'aimerais obtenir :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
 
<formats>
  <item ID="YB1.36LT">
  <title ln="en">Carton Can 1.36lt</title> 
  <title ln="fr"> Carton Can 1.36lt</title> 
  </item>
.......
Alors mon xslt :
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
 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
	<xsl:template match="formats">
		<formats>
			<xsl:apply-templates select="/ROOT/info/formats/item"/>
		</formats>
	</xsl:template>
        <xsl:template match="/ROOT/info/formats/item">
		<xsl:element name="item">
			<xsl:attribute name="id"><xsl:value-of select="@ID"/></xsl:attribute>
			<xsl:apply-templates select="/ROOT/info/formats/item/title"/>
		</xsl:element>
	</xsl:template>
       <xsl:template match="/ROOT/info/formats/item/title">
		<xsl:element name="title">
			<xsl:attribute name="lang"><xsl:value-of select="@ln"/></xsl:attribute>
			<xsl:value-of select="@Value"/>
		</xsl:element>
	</xsl:template>
</xsl:stylesheet>
Mais j'obtiens :
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
 
<formats>
  <item ID="YB1.36LT">
  <title ln="en" Value="Carton Can 1.36lt" /> 
  <title ln="fr" Value="Carton Can 1.36lt" /> 
  <title ln="en" Value="Can 1.2 lt" /> 
  <title ln="fr" Value="Can 1.2 lt" /> 
  </item>
  <item ID="YC1.2LT">
  <title ln="en" Value="Carton Can 1.36lt" /> 
  <title ln="fr" Value="Carton Can 1.36lt" /> 
  <title ln="en" Value="Can 1.2 lt" /> 
  <title ln="fr" Value="Can 1.2 lt" /> 
  </item>
  .......
Bon voilà... ce fût long... mais est-ce que quelqu'un voit mon erreur... c'est certainement très simple, mais je débute avec XML et XSLT...

Merci d'avance