definition: |
optXml :: String -> [XmlExp] -> [XmlExp] -> XmlExp optXml tag elems [] = xml tag elems optXml tag elems (x:xs) = if tag == tagOf x then x else optXml tag elems xs |
demand: |
argument 3 |
deterministic: |
deterministic operation |
documentation: |
--- The operation `optXml` can be used in transformations of XML elements --- to insert a structure with a given tag depending on the presence --- of this tag in a list of XML strucutres. --- For this purpose, `optXml t xs ys` evaluates to `xml t xs` --- if there is no element with tag `t` in `ys`, otherwise the first element --- of `ys` with tag `t` is returned. --- --- The following definition shows a usage of `optXml`: --- --- transNickPhone --- (deepXml "entry" --- (withOthers [xml "name" [xtxt n], --- xml "first" [xtxt f], --- xml "phone" phone] --- others)) = --- xml "nickphone" [optXml "nickname" [xtxt (f++n)] others, --- xml "phone" phone] |
failfree: |
(_, _, _) |
indeterministic: |
referentially transparent operation |
infix: |
no fixity defined |
iotype: |
{(_,_,{[]}) |-> {XElem} || (_,_,{:}) |-> _} |
name: |
optXml |
precedence: |
no precedence defined |
result-values: |
_ |
signature: |
String -> [XML.XmlExp] -> [XML.XmlExp] -> XML.XmlExp |
solution-complete: |
operation might suspend on free variables |
terminating: |
possibly non-terminating |
totally-defined: |
reducible on all ground data terms |