[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Finding another element with the same name as the curr

Subject: Finding another element with the same name as the current node
From: Jo Bourne <venus@xxxxxxxxx>
Date: Thu, 01 Feb 2001 23:39:05 +1100
another name for helvetica
Hello,

My xml document has two main "branches" and while processing elements in one
branch I need to find an element in the other branch with the same name and
extract the value of one of its attributes. Is there a way of finding the
name of the element currently being processed in a for-each loop and
inserting it as a variable within the loop?

Thanks 
Jo

Sample page:
<page>
<branch1>
 <child1>blah</child1>
 <child2>blah</child2>
 <child3>blah</child3>
</branch1>
<branch2>
 <child1 att="x">blah</child1>
 <child2 att="x">blah</child2>
 <child3 att="x">blah</child3>
</branch2>
</page>


Sample for-each loop ("NAME_OF_CURRENT_ELEMEN" indicates where I think I
need to put the name of the current element as a variable):

            <xsl:for-each select="child::*">
                <tr>
                    <td><font face="Arial, Helvetica,
sans-serif"><xsl:apply-templates
select="//branch1/NAME_OF_CURRENT_ELEMENT"><xsl:value-of
select="@att"></xsl:apply-templates></font></td>
                    <td><font face="Arial, Helvetica,
sans-serif"><xsl:copy-of select="./*|./text()"/></font></td>
                </tr>
            </xsl:for-each>


-- 
Jo Bourne
Virtual Artists Pty Ltd


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.