Article View: fr.comp.text.xml
Article #9071Re: [DEBUTANT] Lire les attributs en XSL
From: Pierre-Charles David
Date: Thu, 14 Jun 2001 15:03
Date: Thu, 14 Jun 2001 15:03
52 lines
2335 bytes
2335 bytes
Ed wrote: > J'ai l'XML suivant en entree: > > <category name="toto"> > <map> > 1 > </map> > <map> > 2 > </map> > <map> > 3 > </map> > </category> > > et je veux generer celui ci: > > <entry name="toto"> > <map> > 1 > </map> > </entry> > > Pour cela j'ai ecrit le XSL suivant (je debute alors si vous vouyez des truc > bizarres, dites le moi!) > > <xsl:template match='/category'> > <xsl:element name='entry'> > <xsl:attribute name="name"></xsl:attribute> > <xsl:apply-templates select='map[1]'/> > </xsl:element> > </xsl:template> > (il y a ensuite un template qui gere le map, mais le probleme n'est pas la) > > Ca marche (presque) mais je n'arrive pas a recuperer l'attribut 'name' de na > category pour en faire un attribut de mon entry. > > Comment qu'on fait ? L'expression XPath pour r�cup�rer la valeur d'un attribute de nom toto est @toto. Dans ton cas �a donne: <xsl:attribute name="name"> <xsl:value-of select="@name"/> </xsl:attribute> -- Pierre-Charles David (pcdavid <at> emn <dot> fr) DEA Informatique, �cole des Mines de Nantes, France
Technical Details
Message-ID:
<3B28D286.3020706@nospam.emn.fr>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!opentransit.net!proxad.net!feeder2-1.proxad.net!nnrp6.proxad.net.POSTED!not-for-mailReferences:
<9gah5k$476$1@reader1.fr.uu.net>Show Full Headers
Complete Article Headers
X-Google-Language: FRENCH,ASCII X-Google-Thread: 114f60,c2c1cbbfb181ce20 X-Google-Attributes: gid114f60,public X-Google-ArrivalTime: 2001-06-14 08:03:49 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!opentransit.net!proxad.net!feeder2-1.proxad.net!nnrp6.proxad.net.POSTED!not-for-mail Message-ID: <3B28D286.3020706@nospam.emn.fr> From: Pierre-Charles David <pcdavid@nospam.emn.fr> Reply-To: pcdavid@nospam.emn.fr Organization: Ecoles des Mines de Nantes User-Agent: Mozilla/5.0 (X11; U; Linux 2.4.2 i686; en-US; rv:0.9.1) Gecko/20010607 X-Accept-Language: fr, en MIME-Version: 1.0 Newsgroups: fr.comp.text.xml Subject: Re: [DEBUTANT] Lire les attributs en XSL References: <9gah5k$476$1@reader1.fr.uu.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Lines: 53 Date: Thu, 14 Jun 2001 15:03:47 GMT NNTP-Posting-Host: 193.54.76.161 X-Complaints-To: abuse@proxad.net X-Trace: nnrp6.proxad.net 992531027 193.54.76.161 (Thu, 14 Jun 2001 17:03:47 CEST) NNTP-Posting-Date: Thu, 14 Jun 2001 17:03:47 CEST