[DOM] interprétation de balises HTML
Bonjour,
J'aurais besoin d'un coup de main pour du xslt et du php. Je m'explique :
J'ai un document xml que je transforme en un autre document xml mais qui contient des balises html. et ce que je voudrais c'est lorsque je lit ce document avec php (5), lorsque je récupère la valeur du noeud dans une variable, les balises html ne soient pas interprétées. voilà du code :
une partie du fichier xsl (en résumé...) :
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
|
<!-- Périodes -->
<xsl:template match="Periodes">
<xsl:if test="DetailPeriode/Dates/DetailDates">
<div class="periodes">
<h3>Périodes d'ouverture <xsl:value-of select="2008"/></h3>
<xsl:value-of select="." />
<table cellpadding="0" cellspacing="0" summary="Détail des périodes d'ouvertures">
<thead>
<tr>
<th id="periode">Période </th>
<th id="heures">Horaires </th>
<th id="ouverture">Ouvert </th>
<th id="fermeture">Fermé </th>
<th id="comments"> </th>
</tr>
</thead>
<tbody>
<xsl:apply-templates select="." />
</tbody>
</table>
</div>
</xsl:if>
</xsl:template> |
Le fichier xml qui en ressort est :
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
|
<field name="periode">
<div class="periodes">
<h3>Périodes d'ouverture 2008</h3>
<table cellpadding="0" cellspacing="0" summary="Détail des périodes d'ouvertures">
<thead>
<tr>
<th id="periode">Période </th>
<th id="heures">Horaires </th>
<th id="ouverture">Ouvert </th>
<th id="fermeture">Fermé </th>
<th id="comments"/>
</tr>
</thead>
<tbody>
<tr>
<td headers="periode">
Du 01/01/2008 au 31/12/2008</td>
<td headers="heures">
de 10h00 à 12h45
de 14h00 à 19h00</td>
<td headers="ouverture"/>
<td headers="fermeture">Dimanche, LundiMardi</td>
<td headers="comments"/>
</tr>
</tbody>
</table>
</div>
</field> |
Lecture du fichier xml via php :
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
$doc = DOMDocument::load($fichier);
if( $doc===false )
throw new appException(appException::CONFIG_PARSE_ERROR);
// lit le fichier à la recherche de l'identifiant du parent
$xpath = new DOMXPath( $doc );
// Place un pointeur sur la source de données
$dts = $xpath->query( '/entry/field' );
foreach($dts as $noeud){
$valueAttrib = $noeud->getAttribute('name');
$value = $noeud->nodeValue;
} |
J'aimerais avoir dans ma variable ce code sans que php interprete les balises.
Merci