Must be a loop error

R

rosemm

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>
 
R

Richard Tobin

rosemm said:
<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: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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top