From: JA (jachard@sandaur.com)
Date: 19/01/2001 - 19:59
Bonjour,
voilà les éléments, le fichier XML, le squelette HTML contenant la
présentation, le fichier XSL ne contenant que le traitement des noeuds.
le but, c'est de pouvoir me déplacer dans ma page HTML entre les diférents
éléments.
merci
//////////////////////////////
// Fichier XML
/////////////////////////////
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="dep.xsl"?>
<elements>
<element id="a01">
<nom>nom 01</nom>
<adresse>adresse 01</adresse>
</element>
<element id="a02">
<nom>nom 02</nom>
<adresse>adresse 02</adresse>
</element>
<element id="a03">
<nom>nom 01</nom>
<adresse>adresse 03</adresse>
</element>
<element id="a03">
<nom>nom 03</nom>
<adresse>adresse 03</adresse>
</element>
</elements>
/////////////////////////////////////
///Fichier squelette HTML de présentation
////////////////////////////////////////
<?xml version="1.0" encoding="ISO-8859-1"?>
<html>
<head>
<title>Essai de déplacement</title>
</head>
<body>
<table width="100%" border="1">
<tr>
<td width="25%" align="center">précédent</td>
<td width="25%" align="center"> </td>
<td width="25%" align="center"> </td>
<td width="25%" align="center">suivant</td>
</tr>
<tr>
<td colspan="4" align="center">TITRE TABLEAU</td>
</tr>
<tr>
<td align="right"> Nom : </td>
<td align="left"><nom/> </td>
<td align="right">Adresse : </td>
<td align="left"><adresse> </adresse></td>
</tr>
</table>
<p>Enter the body text of your HTML document here</p>
</body>
</html>
////////////////////////////
// fichier XSL
////////////////////////////
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output method="html" indent="yes" version="4.0"/>
<xsl:variable name="page" select="/"/>
<xsl:variable name="corps" select="document('dep.htm')"/>
<xsl:template match="/">
<xsl:apply-templates select="$corps/html/*"/>
</xsl:template>
<xsl:template match="nom">
<xsl:value-of select="$page//nom" />
</xsl:template>
<xsl:template match="adresse">
<xsl:value-of select="$page//adresse" />
</xsl:template>
<xsl:template match="@* | *">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
--
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:05 UTC
webmaster@xmlfr.org
|