Précédent   Forum des professionnels en informatique > PHP > Bibliothèques et frameworks > XML > XSL & XSLT
XSL & XSLT Forum d'entraide pour les extensions XSL et XSLT permettant de manipuler vos documents XML à l'aide de feuilles de style et de transformations avec PHP. Avant de poster -> tutoriels XSL et XSLT
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 08/06/2006, 13h06   #1
Membre régulier
 
Avatar de camyo
 
Inscription : juin 2004
Messages : 213
Détails du profil
Informations personnelles :
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations forums :
Inscription : juin 2004
Messages : 213
Points : 70
Points : 70
Par défaut [XSLT] XML/XSL > XML parser error 3

Bonjour

j'ai un petit soucis ...
(ai je bien placé mon message forum XML serait il pas mieux?)
mais c'est pas ça...

je m'explique:

je reçois un flux XML que j'affiche dans ma page php

souvent ça marche mais des fois j'ai :
Citation:
Warning: Sablotron error on line 117: XML parser error 3: no element found in /home.2/sudguide/www/rencontre/index.php on line 47

l'URL en question est:ici

je met aussi le code

Exemple de XML
Code XML :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?xml version="1.0" encoding="UTF-8" ?> 
<profil>
 <item>
  <id>2122494</id> 
  <login>lasciamifare</login> 
  <sexe>Un homme</sexe> 
  <age>53</age> 
  <yeux>Marron</yeux> 
  <cheveux>Chauve</cheveux> 
  <pays>Italia</pays> 
  <region>Lazio</region> 
  <departement /> 
  <nom_departement>Roma</nom_departement> 
  <ville>Roma</ville> 
  <description>Sono qui per conoscere persone simpatiche e trasgressive: vorrei conoscere una donna decisa e determinata con cui condividere piacevoli momenti senza crearci troppe paranoie per il futuro... Sono serio ma non serioso, molto discreto ed affidabile...e so esser molto dolce e passionale</description> 
  <webcam>yes</webcam> 
  <photo>/pixs0/l/a/lasciamifare.jpg</photo> 
 </item>
</profil>

Mon code 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
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE xsl:stylesheet  [
	<!ENTITY nbsp   "*">
	<!ENTITY copy   "©">
	<!ENTITY reg    "®">
	<!ENTITY trade  "™">
	<!ENTITY mdash  "—">
	<!ENTITY ldquo  "“">
	<!ENTITY rdquo  "”"> 
	<!ENTITY pound  "£">
	<!ENTITY yen    "¥">
	<!ENTITY euro   "€">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="iso-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<xsl:template match="/">
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>test xml</title>
<link href="/sudguide.css" rel="stylesheet" type="text/css" />
</head>
<body>
 
<div align="center"><br/>
    <xsl:for-each select="profil/item"> 
      <table bgcolor='#F4CBDF' cellspacing='0' width='600' style='border:1px solid #993366;border-collapse:collapse;'>
        <tr>
          <td width="70" align="center" valign="middle"><span class="bloc"><a href="http://sud-guide.love.easyrencontre.com/u_page.php?id={id}" target="_blank"><img src="http://sud-guide.love.easyrencontre.com/{photo}" alt="{login}" style='border:1px solid #993366;' /></a></span></td>
          <td width="524" colspan="2" valign="top" class="Vert11BLEU" align="left"><p><b><xsl:value-of select="login"/></b>&nbsp; 
                <xsl:if test='sexe="Un homme"'>
                  <img src="/images/masc.gif" alt="Un homme" />&nbsp;
                    </xsl:if>
                <xsl:if test='sexe="Une femme"'>
                  <img src="/images/femi.gif" alt="Une femme" />&nbsp;
                    </xsl:if>
                <span class="Vert10BLEU"><xsl:value-of select="age"/>&nbsp;ans</span></p>
              <p align="justify" style="margin-right:5px"><xsl:value-of select="description"/></p>
            <p>[<u>Localisation</u> : <span class="Vert10BLEU"><xsl:value-of select="pays"/></span> &gt; <span class="Vert10BLEU"><xsl:value-of select="region"/></span> &gt; <span class="Vert10BLEU"><xsl:value-of select="nom_departement"/></span>&nbsp;<span class="Vert10BLEU"><xsl:value-of select="departement"/></span> &gt; <xsl:value-of select="ville"/>]</p></td>
        </tr>
      </table>
      <br />
    </xsl:for-each> 
 
 
</div>
</body>
</html>
 
</xsl:template>
 
 
</xsl:stylesheet>


Et pour finir le PHP
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
$xh = xslt_create();
 
$file=fopen("http://sud-guide.love.easyrencontre.com/flux/XML.php?age_min=15&ville=$ville","r");
$xml=fread($file,16384);
fclose($file);
 
$file=fopen("lecture.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";
?>

L'erreur se situe a la ligne 47 de ma page PHP soit
Code :
$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments);
Si quelqu'un sait ..... merci d'avance
camyo est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 08/06/2006, 14h42   #2
Membre régulier
 
Avatar de camyo
 
Inscription : juin 2004
Messages : 213
Détails du profil
Informations personnelles :
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations forums :
Inscription : juin 2004
Messages : 213
Points : 70
Points : 70
j'voulais deplacer mon message mais finalement je sais pas ou le mettre ....

Mais quitte à incister ...

si quelqu'un a une piste
car moi le pipotron, non le cyclotron ou le Sablotron

j'y connais pas grand chose....


MErci d'avance
camyo est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 22h07.


 
 
 
 
Partenaires

Hébergement Web