RE: ancestor problem
| Newsgroups | gmane.comp.mozilla.devel.layout.xslt |
|---|---|
| Message-ID | <[email protected]> |
Hi, > I am kind of newbie with xsl and I have the following (really > anoying) > problem : XSL-List <http://www.mulberrytech.com/xsl/xsl-list/> is a better place to ask general XSLT/XPath questions. > I have a xml doc like this: > > <result> > <left> > <ligne> > <couleur>987656</couleur> > <ligne> > <couleur/>* > </ligne> > </ligne> > <ligne> > <couleur>666666</couleur> > <ligne> > <couleur/>* > </ligne> > </ligne> > </left> > </result> > > Is there a way to get the value of the first level couleur while > processing the second level ligne ? What do you mean with "value of the first level couleur"? Concatenation of the string values? > I process something like apply-template match:"//ligne/ligne" > > I tried with this xpaht expression : <xsl:value-of > select="ancestor::left/ligne/couleur*"/> > > But I get a list of all first level couleur... That will actually just give you "987656", as the result of that expression is a node-set and xsl:value-of will extract the string value of the first node in document order. How about preceding::couleur[1] or ancestor::ligne[2]/couleur Cheers, Jarno