Go Back   CodingForums.com > :: Client side development > XML

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-15-2002, 05:20 AM   PM User | #1
brothercake
Senior Coder


 
Join Date: Jun 2002
Location: near Oswestry
Posts: 4,508
Thanks: 0
Thanked 0 Times in 0 Posts
brothercake is an unknown quantity at this point
I don't understand the interaction of xsl:for-each and xsl:value-of

Say I've got really simple xml:

Code:
<webpage>
    <para>some text in paragraph 1</para>
    <para>some text in paragraph 2</para>
    <para>some text in paragraph 3</para>
</webpage>
And what I want to do is:

Code:
<xsl:for-each select="webpage/para">
    <p>
        <xsl:value-of select="para" />
    </p>
</xsl:for-each>
But of course it doesn't work - there's no <para> inside <para> to get the value of !

I'm obviously failing to grasp something fundamental ... ??
brothercake is offline   Reply With Quote
Old 12-15-2002, 04:30 PM   PM User | #2
jkd
Senior Coder

 
jkd's Avatar
 
Join Date: May 2002
Location: metro DC
Posts: 3,163
Thanks: 1
Thanked 18 Times in 18 Posts
jkd will become famous soon enough
Inside the for-each, the para element is now the context node.

Use:

<xsl:value-of select="."/>

__________________
jasonkarldavis.com
jkd is offline   Reply With Quote
Old 12-15-2002, 04:53 PM   PM User | #3
brothercake
Senior Coder


 
Join Date: Jun 2002
Location: near Oswestry
Posts: 4,508
Thanks: 0
Thanked 0 Times in 0 Posts
brothercake is an unknown quantity at this point
Simple as that ... That clears it up nicely. Thanks
brothercake is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:57 AM.


Advertisement
Log in to turn off these ads.