xsl-list
[Top] [All Lists]

error in accessing sibling NodeList

2005-01-20 12:24:46
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




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>