|
[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
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








