j'ai un fichier xml et un fichier xslt correspondant
je veux obtenir un fichier html qui peut se lancer avec un navigateur
voici mon code python:
le probleme c'est que j'obtient None comme retour
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 from lxml import etree dom = etree.parse(path_xml) xslt =etree.parse(path_xslt) transform = etree.XSLT(xslt) newdom = transform(dom) print(etree.tostring(newdom, pretty_print=True))
et voici mon fichier xslt : vu que je ne suis que débutante j'ai allégé au maximum mon fichier parce que j'ai cru qu'il était la cause du probleme mais il s'est avérait que le probleme persiste quand meme:
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 <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" doctype-system="about:legacy-compat" encoding="UTF-8" indent="yes" /> <xsl:template match="verfication"> <html> <head> <meta charset="utf-8"/> </head> <body> <p><img src="image.jpg" alt="Binevenue"/></p> <h1 align="center" > Comparaison Status= FALSE </h1> <p>Nombre d'erreurs = <xsl:value-of select="verification/nberror"/> </p> <p><a href="">See more Details ...</a></p> </body> </html> </xsl:template> </xsl:stylesheet>
Partager