This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problem to compare a value with a set of tag content



Thank you, David

I'm very confuse, i made a mistake in writing my structure :

the real  one is

<liste>
     <compte>
        <pdf>1</pdf>
        <pdf>4</pdf>
        ...
     </compte>
     <annonce id ="1">
            bla bla
     </annonce>
     <annonce id ="2">
            bla bla
     </annonce>
     <annonce id ="3">
            bla bla
     </annonce>
</liste>

that why i needed a nested structure.

i tried five solutions
<xsl:for-each select="liste/annonce">
     <xsl:for-each select="../compte/pdf">
1        <xsl:variable name="en-pdf" select=".=@id"/>
2        <xsl:variable name="en-pdf" select=".=../@id"/>
3        <xsl:variable name="en-pdf" select="@id=."/>
4        <xsl:variable name="en-pdf" select="../annonce/@id=."/>
5        <xsl:variable name="en-pdf" select="../../annonce/@id=."/>
     </xsl:for-each>
</xsl:for-each>

with no succes, i'm stuck !

Xavier




David Carlisle wrote:

 >>of tag content
 >>
 >
 >the content of a tag is the stuff between < and >
 >If you mean the stuff between <xxx> and </xxx> then that is the content
 >of the xxx element not the content of a tag.
 >
 >
 >>Question 1 : Are nested for-each statements allowed ?
 >>
 >
 >yes
 >
 >But your example appears confused (so i can't tell what you want)
 >
 > <xsl:for-each select="annonce">
 >  so here the current node is an annonce.
 >                <xsl:variable name="en-pdf">
 >                    <xsl:for-each select="compte/pdf">
 >  so here you are iterating over all pdf children of compute children of
 > the current element but that is empty as the annonce element does not
 > have any compte children. You could use /compte/pdf which would select
 > something but there is no point in nesting such a for-each as it will
 > re-evaluate the same thing each time for each item in the outer list.
 >
 >>Question 2 :
 >>
 >
 >I think you just want something like
 >
 > <xsl:for-each select="annonce/id">
 >       <xsl:variable name="en-pdf" select=".=../../compte/pdf"/>
 >
 >which will iterate over the <id> and  in each case $en-pdf will be
 >true() or false()
 >
 >David
 >
 >
 >_____________________________________________________________________
 >This message has been checked for all known viruses by Star Internet
 >delivered through the MessageLabs Virus Scanning Service. For further
 >information visit http://www.star.net.uk/stats.asp or alternatively call
 >Star Internet for details on the Virus Scanning Service.
 >
 > XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
 >
 >



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]