🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fr.comp.text.xml
Article #141

Xslt avec une seconde base xml

#141
From: CrazyCat
Date: Mon, 04 Jan 2010 17:44
47 lines
2513 bytes
Bonjour � tous, et meilleurs voeux !

Je dois faire une transformation XSL sur un fichier (jusque l� pas de 
probl�me), et ce fichier contient des identifiants qui doivent me 
permettre de retrouver des libell�s pr�sents dans un autre fichier XML.

Mon probl�me est que je ne vois pas trop comment faire. J'ai suivi une 
piste qui m'am�nerait � faire:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="utf-8" indent="yes" />
<xsl:strip-space elements="*" />
     <!-- Only make xml file if it's an agency which is a client  -->
     <!-- Parsing the xml file  -->
     <xsl:template match='Locations'>
         <xsl:for-each select='Location'>
             <xsl:value-of select="ZipCode" /> :
             <xsl:variable name="CityId" 
select="document('/home/user/Cities.xml', /CityId)" />
             <xsl:value-of select="$CityId/@CityId" />
         </xsl:for-each>
     </xsl:template>
</xsl:stylesheet>

Mon fichier initial est de la forme:
<?xml version="1.0" encoding="utf-8"?>
<root>
    <Locations>
       <Location>
           <Address>Une adresse</Address>
           <ZipCode>75000</ZipCode>
           <CityId>1</CityId>
       </Location>
    </Locations>
</root>

Et mon fichier Cities.xml de la forme:
<Cities>
    <City CityId="1">Paris</City>
    <City CityId="2">Lyon</City>
</Cities>

Cette solution ne semble pas marcher, quelqu'un aurait-il une id�e ?

Merci d'avance.
Technical Details
Message-ID: <hht9da$692$1@speranza.aioe.org>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!news.mixmin.net!aioe.org!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 8a75585569,ea8c1daf85e4d2b6,start
X-Google-Attributes: gid8a75585569,public,usenet
X-Google-NewGroupId: yes
X-Google-Language: FRENCH,ASCII
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!news.mixmin.net!aioe.org!not-for-mail
From: CrazyCat <crazycat@c-p-f.org>
Newsgroups: fr.comp.text.xml
Subject: Xslt avec une seconde base xml
Date: Mon, 04 Jan 2010 18:44:12 +0100
Organization: Aioe.org NNTP Server
Lines: 47
Message-ID: <hht9da$692$1@speranza.aioe.org>
Reply-To: crazycat@c-p-f.org
NNTP-Posting-Host: FP4atChjGrKl42WvpM7ffA.user.speranza.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
X-Complaints-To: abuse@aioe.org
X-Notice: Filtered by postfilter v. 0.8.1
Cancel-Lock: sha1:Y6vsiLGie5WxZ1T7I8OB9fH7klg=
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0