difference between these 2 rules...

Pedro Salazar <[email protected]> 03 Mar 2004 12:43:11 +0000
Newsgroups gmane.text.xml.schematron
Message-ID <[email protected]>
Greetings,

I think these 2 rules below should be equal, however they're different. 

rule 1:
<rule context="A">
  <assert test="B/C//D[@type='IN' and
not(@value)]/@index=W/V/@targetIndex" > fail! </assert>
</rule>

rule 2:        
<rule context="A/B/C//D[@type='IN' and not(@value)]">
  <assert test="./@index=../../../../W/V/@targetIndex"> fail! </assert>
</rule>

The simple case is:

<A>
   <B><C><unknown>
	<D type="IN" index="1" />
	<D type="IN" index="2" />
   </unknown></C></B>
   <W>
	<V targetIndex="1" />
	<V targetIndex="3" />
   </W>
</A>

The purpose of this these rules is detect any <V> element which
'@targetIndex' is pointing to a non-existent <D> element by its
'@index'. In this case, <V targetIndex="3" /> would fail!

The problem is that the rule 1 doesn't work but the rule 2 (for me
should be equal) work just fine. 

Why?

regards,
Pedro Salazar.   
-- 
-PS



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click