alors la je suis sur du php+ajax+xml
lol
voici les codes sources :
xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<personnes>
<personne id="1">
<nom>DUJNOUX</nom>
<prenom>Paul</prenom>
<age>18</age>
</personne>
<personne id="2">
<nom>BATTONDCHAISE</nom>
<prenom>Jérôme</prenom>
<age>34</age>
</personne>
</personnes>
xsl :
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
<xsl:param name="id"/>
<xsl:template match="/"
<span> Nom <br/>
<select size="1" name="nom"
onchange="document.forms['chgnom'].submit();">
<option>
<xsl:if test="$id = ''">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
</option>
<xsl:apply-templates select="personnes/personne"/>
</select>
<xsl:if test="$id != ''">
<br/> Prénom : <br/>
<input name="prénom " type="text">
<xsl:attribute name="value">
<xsl:value-of select="personnes/personne[@id = $id]/prenom"/>
</xsl:attribute>
</input>
<br/> Age : <br/>
<input name="age" type="text">
<xsl:attribute name="value">
<xsl:value-of select="personnes/personne[@id = $id]/age"/>
</xsl:attribute>
</input>
</xsl:if>
</span>
</xsl:template>
<xsl:template match="personne">
<option>
<xsl:if test="@id = $id">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:attribute name="value">
<xsl:value-of select="@id"/>
</xsl:attribute>
<xsl:value-of select="nom"/>
</option>
</xsl:template>
</xsl:stylesheet>
et php
<?
print "<form action=\"" ;
print($_SERVER['PHP_SELF']) ;
print "\" method=\"post\" id=\"chgnom\">" ;
$id = $_POST['nom'];
/* load the xml file and stylesheet as domdocuments */
$xsl = new DomDocument();
$xsl->load('personnes.xsl');
$inputdom = new DomDocument();
$inputdom->load('personnes.xml');
/* create the processor and import the stylesheet */
$proc = new XsltProcessor();
$xsl = $proc->importStylesheet($xsl);
/* create param */
$proc->setParameter(null, "id", $id);
/* transform and output the xml document */
$newdom = $proc->transformToDoc($inputdom);
print $newdom->saveXML();
print "</form>" ;
?>
voila
