Bonjour,
j'ai presque trouvé la solution à mon problème. Maintenant j'obtiens ceci:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
<rdf:Description rdf:about="http://mondocument.org">
<title
xmlns="http://purl.org/dc/elements/1.1/">
le titre de mon document
</title >
</rdf:Description>
<rdf:Description rdf:about="http://mondocument.org">
<description
xmlns="http://purl.org/dc/elements/1.1/">
http://mondocument.org
</description >
</rdf:Description>
</rdf:RDF>
Le problème est que je veux obtenir ceci:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
<rdf:Description rdf:about="http://mondocument.org">
<title
xmlns="http://purl.org/dc/elements/1.1/">
le titre de mon document
</title >
</rdf:Description>
</rdf:RDF>
Comme vous pouvez le voir, pour un même enregistrement j'obtiens, en quelque sorte, un doublon en affichage. Et c'est ce que je tente d'éliminer.
Voici la version de mon fichier xhtml simplifiée pour une question de clarté:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="Test.xslt"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" />
<meta name="DC.title" content="le titre de mon document" />
<meta name="DC.description" content="http://mondocument.org" />
<title>Un petit document</title>
</head>
<body>
<p>Test</p>
</body>
</html>
Finalement, voici mon fichier xslt:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<xsl:output method="html" version="1.0" encoding="ISO-8859-1" indent="yes"/>
<xsl:template match="xhtml:link">
</xsl:template>
<xsl:template match="xhtml:link">
<html>
<body><pre>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
<xsl:if test="substring-before(@rel,'.') = 'schema' ">
<xsl:for-each select="../xhtml:meta[substring-before(@name,'.') = substring-after(current()/@rel,'.')]">
<rdf:Description rdf:about="http://mondocument.org">
<<xsl:value-of select="substring-after(./@name,'.')"/>
xmlns="<xsl:value-of select="../xhtml:link[substring-after(@rel,'.')=substring-before(current()/@name,'.')]/@href"/>">
<xsl:value-of select="@content"/>
</<xsl:value-of select="substring-after(./@name,'.')"/> >
</rdf:Description>
</xsl:for-each>
</xsl:if>
</rdf:RDF>
</pre></body>
</html>
</xsl:template>
</xsl:stylesheet>
Mon problème vient du fait que je ne trouve pas comment obtenir ce que j'ai besoin sans utiliser un "xsl:for-each". Est-ce que quelqu'un aurait une suggestion? Ça me rendrait vraiment service!
Configuration: Windows XP Pro SP3
Firefox 3.0.1