Super c'est impeccable ...
Un grand merci
A+
HP
-----Message d'origine-----
De : xml-tech-bounce@xmlfr.org [mailto:xml-tech-bounce@xmlfr.org] De la part
de Eric van der Vlist
Envoyé : jeudi 31 mars 2005 15:42
À : xml-tech@xmlfr.org
Objet : [xml-tech] Re: Petit problème avec xslt
Le jeudi 31 mars 2005 à 13:33 +0200, Patrice Harmegnies a écrit :
> Une autre solution mais ...
>
> Dommage que order-by avec +nom;prenom
> Ne marche pas avec xmlns:xsl="http://www.w3.org/1999/XSL/Transform
> Mais avec xmlns:xsl="http://www.w3.org/TR/WD-xsl (uniquement pour
> Microsoft) Ce dernier ne supportant pas la fonction substring
Je ne comprend pas bien le problème! Vous pouvez utiliser deux xsl:sort ou
un xsl:sort unique portant sur la concaténation des nom et prénom...
Personnellement, j'utiliserais des clés comme Stéphane Bonhomme vous l'a
conseillé.
Que reprochez-vous à la transformation suivante :
<?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"/>
<xsl:key name="initiales" match="adherent" use="substring(nom, 1, 1)"/>
<xsl:template match="/">
<html>
<head>
<title>liste des adhérents</title>
</head>
<body>
<xsl:apply-templates
select="/adherents/adherent[ count( . | key('initiales',
substring(nom, 1, 1) )[1] ) = 1 ]"
mode="initiales">
<xsl:sort select="nom"/>
</xsl:apply-templates>
</body>
</html>
</xsl:template>
<xsl:template match="adherent" mode="initiales">
<h3>
<xsl:value-of select="substring(nom, 1, 1)"/>
</h3>
<ul>
<xsl:apply-templates select="key('initiales', substring(nom, 1,
1))">
<xsl:sort select="nom"/>
<xsl:sort select="prenom"/>
</xsl:apply-templates>
</ul>
</xsl:template>
<xsl:template match="adherent">
<li>
<xsl:value-of select="concat(nom, ' - ', prenom)"/>
</li>
</xsl:template>
</xsl:stylesheet>
????
> A quand la standardisation ...
La standardisation est pourtant là :-) ... "http://www.w3.org/TR/WD-xsl"
est une ancienne version de travail de XSLT 1.0 que tout le monde même
Microsoft a fini par abandonner et je en vois plus de raison de l'utiliser!
Cordialement,
Eric van der Vlist
--
Curious about Relax NG? Read my book online.
http://books.xmlschemata.org/relaxng/
------------------------------------------------------------------------
Eric van der Vlist http://xmlfr.org http://dyomedea.com
(ISO) RELAX NG ISBN:0-596-00421-4 http://oreilly.com/catalog/relax
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema
------------------------------------------------------------------------
--
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)
--
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)
Received on Thu Mar 31 19:42:26 2005