(***********************************************************************)
(*
- Time-stamp: <Last modified on 2013-02-07 10:04:30 CET by Kim Nguyen>
+ Time-stamp: <Last modified on 2013-03-04 16:24:20 CET by Kim Nguyen>
*)
open Utils
type path = single_path list
and single_path = Absolute of step list | Relative of step list
and step = axis * test * expr list
-and axis = Self | Attribute | Child | Descendant | DescendantOrSelf | FollowingSibling
- | Parent | Ancestor | AncestorOrSelf | PrecedingSibling | Preceding | Following
+and axis = Self | Attribute | Child
+ | Descendant of bool (* true = descendant-or-self, false = descendant *)
+ | FollowingSibling
+ | Parent
+ | Ancestor of bool (* true = ancestor-or-self, false = ancestor *)
+ | PrecedingSibling
+ | Preceding | Following
and test = QNameSet.t
match a with
Self -> "self"
| Child -> "child"
- | Descendant -> "descendant"
- | DescendantOrSelf -> "descendant-or-self"
+ | Descendant false -> "descendant"
+ | Descendant true -> "descendant-or-self"
| FollowingSibling -> "following-sibling"
| Attribute -> "attribute"
- | Ancestor -> "ancestor"
- | AncestorOrSelf -> "ancestor-or-self"
+ | Ancestor false -> "ancestor"
+ | Ancestor true -> "ancestor-or-self"
| PrecedingSibling -> "preceding-sibling"
| Parent -> "parent"
| Preceding -> "preceding"
print_expr fmt e0;
if need_par0 then pp fmt ")"
+
+
+let invert_axis = function
+| Self | Attribute as a -> a
+| Child -> Parent
+| Descendant (b) -> Ancestor (b)
+| FollowingSibling -> PrecedingSibling
+| Parent -> Child
+| Ancestor (b) -> Descendant (b)
+| PrecedingSibling -> FollowingSibling
+| Preceding -> Following
+| Following -> Preceding
+;;
+