Bonjour,
je récupère sur mon serveur un fichier xml (associé à un fichier xsl) qui me permet de retrouver mes marques pages de firefox (exportés avec l'extension bookmarks synchroniser). Je peux donc ensuite les consulter depuis n'importe quel PC connecté.
J'aimerai intégrer ce fichier à mon site (histoire d'avoir mon menu et compagnie). J'ai suivi un tuto, mais j'ai le message d'erreur suivant :
Citation:
|
Warning: Sablotron error on line 3: XML parser error 5: unclosed token in /home.26/fred/www/test.php on line 34
|
Mes connaissance en xml/xsl sont à peu près équivalentes à zéro et j'ai beau chercher une solution, je ne trouve pas.
un extrait de mon fichier xml
Code XML :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| <?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="xbel2html.xsl"?>
<!DOCTYPE xbel PUBLIC "+//IDN python.org//DTD XML Bookmark Exchange Language 1.0//EN//XML" "http://pyxml.sourceforge.net/topics/dtds/xbel-1.0.dtd">
<xbel>
<title>Marque-pages</title>
<info><metadata owner="Mozilla" BookmarksToolbarFolder="rdf:#$FvPhC3"/></info>
<folder id="rdf%3A#$zkrMe3">
<title>Programmation</title>
<bookmark id="rdf%3A#$AkrMe3" href="http://www.developpez.com/">
<title>Développez.com</title>
<desc>Club des developpeurs : Forum, Cours et tutoriels en programmation : Delphi, C, C++, Java, VB, DotNET, C#, PHP,ASP, UML, XML</desc></bookmark>
</folder>
<folder id="rdf%3A#$Ukefs1">
<title>Perso</title>
<bookmark id="rdf%3A#$Rkefs1" href="http://www.laposte.net/"><title>laposte.net</title><desc>Mon service mails</desc></bookmark>
<bookmark id="rdf%3A#$u7Vhe1" href="http://start.ovh.net/phpMyadmin/"><title>OVH - PhpMyAdmin</title></bookmark>
/folder>
<folder id="rdf%3A#$s59eB1">
<title>Libre & open source</title>
<bookmark id="rdf%3A#$w59eB1" href="http://lesite.org/pub/"><title>Da Linux French Page</title><desc>L'actualité de Linux et du logiciel libre</desc></bookmark> |
mon fichier xsl
Code XML :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
| <xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<HTML>
<HEAD>
<TITLE>
<xsl:value-of select="xbel/title" />
</TITLE>
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
</HEAD>
<BODY>
<div>
<H1>
<xsl:value-of select="xbel/title" />
</H1>
<UL>
<xsl:for-each select="xbel/folder | xbel/bookmark">
<xsl:choose>
<xsl:when test="local-name(.)='folder'">
<xsl:call-template name="displayFolder" />
</xsl:when>
<xsl:when test="local-name(.)='bookmark'">
<xsl:call-template name="displayBookmark" />
</xsl:when>
</xsl:choose>
</xsl:for-each>
</UL>
<p class="footer">Generated from an XBEL compliant file with xbel2html.xsl</p>
</div>
</BODY>
</HTML>
</xsl:template>
<xsl:template name="displayFolder" match="folder">
<LI class="f1"><xsl:value-of select="./title" /></LI>
<UL>
<xsl:for-each select="./folder" >
<xsl:call-template name="displayFolder" />
</xsl:for-each>
<p class="folder">
<xsl:value-of select="./desc" />
</p>
<xsl:for-each select="./bookmark" >
<xsl:call-template name="displayBookmark" />
</xsl:for-each><SPAN>	</SPAN>
</UL>
</xsl:template>
<xsl:template name="displayBookmark" match="bookmark">
<LI>
<xsl:element name="A">
<xsl:attribute name="href">
<xsl:value-of select="./@href" />
</xsl:attribute>
<xsl:value-of select="./title" />
</xsl:element><SPAN>	</SPAN>
<xsl:value-of select="./desc" />
</LI>
</xsl:template>
</xsl:stylesheet> |
mon fichier php
Code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>marques pages</title>
<meta http-equiv="Content-type" content="application/xhtml+xml; charset=ISO-8859-1" />
<meta http-equiv="content-language" content="fr" />
<link href="style.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<?php
//mon menu
include ('./inc/header.inc.php');
//Le fichier xml
$xh = xslt_create();
$file=fopen("xbel.xml","r");
$xml=fread($file,16384);
fclose($file);
$file=fopen("xbel2html.xsl","r");
$xsl=fread($file,16384);
fclose($file);
$arguments = array(
'/_xml' => $xml,
'/_xsl' => $xsl
);
$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments);
xslt_free($xh);
print "$result";
?>
</body> |
Merci de votre aide.
fred