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. Advertising

  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. Advertising

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. Replies:
    4
    Views:
    441
    Kabal
    Aug 23, 2003
  2. NeoGeoSNK
    Replies:
    25
    Views:
    924
    NeoGeoSNK
    Nov 24, 2006
  3. pvong
    Replies:
    7
    Views:
    4,041
    erum mirza
    Nov 20, 2010
  4. Isaac Won
    Replies:
    9
    Views:
    371
    Ulrich Eckhardt
    Mar 4, 2013
  5. Peter Otten
    Replies:
    1
    Views:
    70
    Peter Otten
    Dec 4, 2013
Loading...

Share This Page