Must be a loop error

Discussion in 'XML' started by rosemm, Jan 19, 2005.

  1. rosemm

    rosemm Guest

    Hi.

    I am new to XML. I am working on a pretty simple problem at the moment
    but can't seem to figure out what I am doing wrong. I am trying to
    print the last nameof every member listed in my file. However, all it
    does is reprint the same last name over and over again.

    What am I doing wrong? Below is the code I am using.


    <xsl:template match="/">
    <xsl:for-each select ="/MEMBER">
    <xsl:apply-templates select="/MEMBER"/>
    </xsl:for-each>
    </xsl:template>

    <xsl:template match="/MEMBER">
    <xsl:value-of select="/MEMBER/@VALUE"/>
    </xsl:template>
     
    rosemm, Jan 19, 2005
    #1
    1. Advertisements

  2. In article <>,
    rosemm <> wrote:

    ><xsl:for-each select ="/MEMBER">
    ><xsl:apply-templates select="/MEMBER"/>
    ></xsl:for-each>


    For each MEMBER, this calls the template for each MEMBER. So for
    10 members, it will call it 100 times! You just want

    <xsl:apply-templates select="/MEMBER"/>

    ><xsl:value-of select="/MEMBER/@VALUE"/>


    Then, for each of the 100, it gets the VALUE of the first one!
    You want

    <xsl:value-of select="@VALUE"/>

    -- Richard
     
    Richard Tobin, Jan 19, 2005
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?VGltOjouLg==?=

    Loop the loop...

    =?Utf-8?B?VGltOjouLg==?=, Feb 16, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    1,609
    Karl Seguin
    Feb 16, 2005
  2. Replies:
    4
    Views:
    526
    Kabal
    Aug 23, 2003
  3. Steven

    while loop in a while loop

    Steven, Mar 24, 2005, in forum: Java
    Replies:
    5
    Views:
    2,485
    Tim Slattery
    Mar 30, 2005
  4. NeoGeoSNK
    Replies:
    25
    Views:
    1,265
    NeoGeoSNK
    Nov 24, 2006
  5. PB
    Replies:
    10
    Views:
    7,039
    Dave Thompson
    Mar 27, 2006
  6. pvong
    Replies:
    7
    Views:
    4,299
    erum mirza
    Nov 20, 2010
  7. Isaac Won
    Replies:
    9
    Views:
    751
    Ulrich Eckhardt
    Mar 4, 2013
  8. Peter Otten
    Replies:
    1
    Views:
    155
    Peter Otten
    Dec 4, 2013
Loading...