[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

Subject: Re: Problem to compare a value with a set of tag content Part II
From: Xavier DAMAY <xsl.list@xxxxxxxxxxxxxxx>
Date: Thu, 30 May 2002 10:40:02 +0200
xsl compare value of tag
Hello,

After more investigation i've got something but none of expected :

<xsl:for-each select="liste/annonce">
  <xsl:variable name="en-pdf">
    <xsl:for-each select="../compte/pdf">
      <xsl:choose>
	<xsl:when test=".=../../annonce/@id">
	  True
	</xsl:when>
	<xsl:otherwise>
          <xsl:value-of select=".=../../annonce/@id"/>
        </xsl:otherwise>	
      </xsl:choose>
    </xsl:for-each>
  </xsl:variable>
...

<xsl:value-of select="$en-pdf"/>

Now the when test is always false,
what i know is : values of pdf are 1 and 3
: values of annonce/@id are 0, 1, 2, 3, and 4
i made a test to see the value of annonce/@id inside of the pdf for-each is always 00, (the first annonce/@id)


I am stuck and puzzled, please help !

Xavier

PS : for memory the structure is
<liste>
    <compte>
       <pdf>1</pdf>
       <pdf>3</pdf>
    </compte>
    <annonce id ="1">
           bla bla
    </annonce>
    <annonce id ="2">
           bla bla
    </annonce>
    <annonce id ="3">
           bla bla
    </annonce>
    <annonce id ="4">
           bla bla
    </annonce>
</liste>

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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.