|
-
May 11th, 2011, 05:05 PM
#1
Finding The Value Of First Element
Hi,
I'm trying to look at an element and find its name, but I don't know how embedded it will be or if there will be multiples.
example input:
<root>
<thing>
<name>Example 1</name>
</thing>
<thing>
<individual>
<name>Example 2</name>
</individual>
</thing>
<thing>
<name>Example 3</name>
<individual>
<name>Example 4</name>
</individual>
</thing>
</root>
I was using:
<xsl:for-each select="//thing">
Name: <xsl:value-of select=".//name"/>
</xsl:for-each>
That did what I wanted for every thing but the third example. I just want the first name.
the result should end up being:
Name: Example 3
Not:
Name Examle 3Example4
I tried this and the result did not change:
<xsl:value-of select=".//name[1]"/>
How do I find the first name tag without knowing the path to it? Is this possible?
Thanks,
Stan
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|