Bonjour,
Voilà j'essaye de produire une page HTML depuis un fichier XML par une transformation XSL, mais le résultat n'est pas flamboyant....
Voilà mes fichiers :
XML :
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 <?xml version="1.0" encoding="ISO-8859-1" ?> <clients xmlns="http://tempuri.org/clients.xsd"> <client no_cli="GAS84903285"> <login>login</login> <password>9456ed9576ad6716b0899162befe0dd0</password> <email_cli>noemail@noemail.org</email_cli> <fax_cli>+41000000</fax_cli> <loc_cli>Ici</loc_cli> <nom_cli>Nom</nom_cli> <npa_cli>0000</npa_cli> <pays_cli>XX</pays_cli> <rue_cli>Rue</rue_cli> <tel_cli>+41000000</tel_cli> </client> </clients>
Et le code en C#
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 <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt"> <xsl:output method="html" encoding="ISO-8859-1" /> <xsl:template match="/"> <xsl:apply-templates select="/client" /> </xsl:template> <xsl:template match="client"> <xsl:value-of select="login" /> </xsl:template> </xsl:stylesheet>
Voilà ca me parait vraiment tout bête, mais ca fonctionne pas. Le XmlReader est "vide"...
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 // Transformation XSL XslTransform xtClients = new XslTransform() ; xtClients.Load ( Session["path"].ToString() + \\extranet\\xml\\clients.xslt" ) ; XPathDocument xpdClients = new XPathDocument( Session["path"].ToString() + "\\extranet\\xml\\clients.xml" ) ; XmlUrlResolver xurClients = new XmlUrlResolver() ; XmlReader xrClients = xtClients.Transform ( xpdClients , null , xurClients ) ; while ( xrClients.Read() ) { litXslClient.Text += xrClients.Value ; }
Merci d'avance pour vos réponses.
Partager