atomic_list_concat([Name, '(@type)'], Field), % Name: 'from' or 'to'
term_to_atom(Search1, Field),
xpath(Step, Search1, Type).
?- Name = 'from', atomic_list_concat([Name, '(@type)'], Field), term_to_atom(Search1, Field).
ERROR: Syntax error: Operator expected
ERROR: from(
ERROR: ** here **
ERROR: @type) .
?- Name = 'from', atomic_list_concat([Name, '(type)'], Field), term_to_atom(Search1, Field).
Name = from,
Field = 'from(type)',
Search1 = from(type).
?- [library(xpath)].
true.
?- Name = 'from', atomic_list_concat([Name, '(@type)'], Field), term_to_atom(Search1, Field).
Name = from,
Field = 'from(@type)',
Search1 = from(@type).
HTH, Carlo
--
You can always define the operator yourself. For example:
$ swipl
...
?- op(200, fy, (@)).
true.
?- Name = 'from', atomic_list_concat([Name, '(@type)'], Field), term_to_atom(Search1, Field).
Name = from,
Field = 'from(@type)',
Search1 = from(@type).
Cheers,
Paulo