From: Pascal EMMA (pascal.emma@laltruiste.com)
Date: 20/01/2003 - 10:52
Bonjour,
J’essaie de transformer via XSLT, un document XHTML vers un autre
document XHTML sans y parvenir directement.
Par contre, lorsque je prends un fragment du document d’origine, soit
l’élément body, cette transformation réussie sans problème.
Fichier d’origine :
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="FR">
<head>
<title>Auteur : Titre du livre</title>
</head>
<body>
<h1>Titre du livre</h1>
<h2>Sous Titre 1</h2>
<p id="para1">Le texte du chapitre 1</p>
<h2>Sous Titre 2</h2>
<p id="para2">Le texte du chapitre 2</p>
<h2>Sous Titre 3</h2>
<p id="para3">Le texte du chapitre 3</p>
<h2>Sous Titre 4</h2>
<p id="para4">Le texte du chapitre 4</p>
<h2>Sous Titre 5</h2>
<p id="para5">Le texte du chapitre 5</p>
<h3>Auteur</h3>
</body>
</html>
Fichier de transformation :
<?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="xml" version="1.0" omit-xml-declaration="no"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
encoding="ISO-8859-1"/>
<xsl:template match="/html/body">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="FR">
<head>
<title>
<xsl:value-of select="h3"/> - <xsl:value-of select="h1"/>
</title>
</head>
<body>
<table>
<caption>
<xsl:value-of select="h1"/>
</caption>
<xsl:for-each select="h2">
<tr>
<th>
<xsl:value-of select="."/>
</th>
</tr>
<tr>
<td>
<xsl:value-of select="following-sibling::p"/>
</td>
</tr>
</xsl:for-each>
<tr>
<th>
<xsl:value-of select="h3"/>
</th>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Je vous remercie pour vos explications et vous souhaite une bonne
journée…
Cordialement,
M. EMMA Pascal
Webmestre du site http://www.laltruiste.com/
--
Devenez redacteur <XML>fr et contribuez au developpement du
xml francophone (http://xmlfr.org/infos/redacteurs/) !
Liste de diffusion "xml-tech@xmlfr.org" (http://xmlfr.org).
Cette liste est a votre disposition pour discuter en francais de
tout sujet technique lie a XML.
Pour resilier votre abonnement, envoyez un message contenant
la commande "unsubscribe" a xml-tech-request@xmlfr.org
(mailto:xml-tech-request@xmlfr.org?Subject=unsubscribe)
Archive générée par hypermail 2.1.3 le 28/06/2004 - 11:06 UTC
webmaster@xmlfr.org
|