-and print_test fmt ts =
- try
- pp fmt "%s" (List.assoc ts
- [ text,"text()";
- node,"node()";
- star, "*" ] )
- with
- Not_found -> pp fmt "%s"
- (if QNameSet.is_finite ts
- then QName.to_string (QNameSet.choose ts)
- else "<INFINITE>"
- )
+and print_test fmt (ts,kind) =
+ let open Tree.NodeKind in
+ match kind with
+ Text -> pp fmt "%s" "text()"
+ | Element | Attribute ->
+ pp fmt "%s" begin
+ if QNameSet.is_finite ts then
+ QName.to_string (QName.remove_prefix (QNameSet.choose ts))
+ else "*"
+ end
+ | Comment -> pp fmt "%s" "comment()"
+ | ProcessingInstruction ->
+ pp fmt "processing-instruction(%s)"
+ begin
+ if ts == star then ""
+ else "\"" ^ (QName.to_string (QName.remove_prefix (QNameSet.choose ts))) ^ "\""
+ end
+ | Node -> pp fmt "%s" "node()"
+ | Document -> pp fmt "%s" "<DOCUMENT>"