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

error in accessing sibling NodeList

Subject: error in accessing sibling NodeList
From: Rahil Qamar Yahoo <qamar_rahil@xxxxxxxxxxx>
Date: Thu, 20 Jan 2005 19:24:46 +0000
sibling error
Hi

I have another query. I am trying to create a generic <xsl:template> which will loop through the entire XML file looking for the word 'ELEMENT' in the attribute rm_class. A portion of the XML file is

------------------------
<archetype xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" archetype_id="Pain.v1draft">
<definition>
<node type="complex object constraint" occurrences="1" id="at0000" rm_class="EVALUATION">
<level>0</level>
<text>Pain</text> <data type="relationship constraint">
<node type="complex object constraint" occurrences="1" id="at0001" rm_class="TREE">
<level>1</level>
<parent>at0000</parent>
<text>Tree</text>
<items cardinality="0..1; ordered" type="relationship constraint">
<node type="complex object constraint" occurrences="1" id="at0003" rm_class="ELEMENT">
<level>2</level>
<parent>at0001</parent>
<text>Pain</text>
<runtime_label type="relationship constraint">
<node type="complex object constraint" occurrences="1" rm_class="CODED_TEXT">
<level>3</level>
<parent>at0001</parent>
<code type="relationship constraint">[ac0001]</code>
<text>Pain</text>
</node>
</runtime_label>
<value type="relationship constraint">
<node type="complex object constraint" occurrences="1" rm_class="TEXT">*</node>
</value>
</node>
</items>
</node>
</data>
</node>
</archetype>
------------------------


The trouble I'm having is in keeping the code independent of the actual file structure. Each XML file that I receive has a slightly different structure which might be Tree, List etc. What I mean is that I will not be able to rely on the XPATH expression '/data/node/items/node' always. I thought I might be able to use the 'following' axis to trace through the XML from the <items> to check all the <node> which have an attribute rm_class="ELEMENT". But thats not working in the <xsl:for-each> construct.

----------------
<xsl:for-each select="following::node/@rm_class='ELEMENT'">
       <xsl:message>Done</xsl:message>
</xsl:for-each>
----------------

All I want is a tree which lists the ELEMENT and its <value>.

How do I go about it sensibly?

Thanks
Rahil

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.