Transformation XML to XML
Bonjour,
Je souhaite récupérer des informations provenant d'un fichier de présentation libre office (en se focalisant sur le content.xml issu de l'extraction de la présentation .odp)
Voici un extrait du fichier content.xml, je souhaite récupérer le contenu de la balise <text:span> par exemple lorsque l'attribut "presentation" de la frame est égal à titre (presentation:class="title")
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
- <office:presentation>
- <draw:page draw:name="Slide1" draw:style-name="a1021" draw:master-page-name="-Layout1-title-Diapositive-de-titre" presentation:presentation-page-layout-name="-PPL1" draw:id="Slide-256">
- <draw:frame draw:id="id156" presentation:style-name="a1026" draw:name="Titre 1" svg:x="0.75in" svg:y="1.75in" svg:width="8.5in" svg:height="1.94675in" presentation:class="title" presentation:placeholder="false">
- <draw:text-box>
- <text:p text:style-name="a1025" text:class-names="" text:cond-style-name="">
- <text:span text:style-name="a1022" text:class-names="">
Rapport dactivité
<text:line-break />
</text:span>
- <text:span text:style-name="a1023" text:class-names="">
<text:s text:c="2" />
</text:span>
<text:span text:style-name="a1024" text:class-names="" />
</text:p>
</draw:text-box>
<svg:title />
<svg:desc />
</draw:frame> |
J'ai tenté ceci en xslt mais je le résultat confirme que je n'ai pas encore compris le fonctionnement de ce langage,
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| <?xml version ="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0">
<xsl:output method="xml" encoding="ISO-8859-1" doctype-public="-//W3C//DTD XHTML//EN" doctype-system="http://www.w3.org/TR/2001/REC-xhtml11-20010531" indent="yes"/>
<xsl:template match="office:presentation">
<xsl:if test="draw:page/draw:frame/@class= 'title'">
<xsl:value-of select="."/>
</xsl:if>
</xsl:template>
</xsl:stylesheet> |
Pourriez-vous m'apporter votre aide je vous en serai reconnaissant,
Bonne journée