This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

JavaScript Patterns


I had a question on patterns.  Note: I'm strictly using JavaScript.  I'm not
using XSL.

First the XML:
<root>
<level>1
<col1>You</col1>
<col2>GO</col2>
</level>
<level>2
<col1>You</col1>
<col2>Stay</col2>
</level>
<level>2
<col1>You</col1>
<col2>Walk</col2>
</level>
</root>

I have the following JS code:

var nodes = doc.selectNodes("//level");    'Where doc is an XML document
for (var n=0; n<nodes.length; n++)
     alert(nodes.item(n).text;

This works and returns all of the levels I want, but it also includes the
children, col1 & col2.  Is there a way just to return the levels ?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]