-- parse apply-template element (return a singleton list)
parseApplyTemplate :: (ArrowXml a) => a XmlTree TApplyTpl
parseApplyTemplate =
    ((hasAttr "output") <+> (hasAttr "var")) >>. (take 1)
    >>>
    ((parseMaybeAttr "output") &&& (parseMaybeAttr "var") &&& (getAttrValue0 "template")
     &&&
     ((getChildren >>> isElem >>> hasName "param"
      >>>
      ((getAttrValue0 "name") &&& (getAttrValue0 "value"))
      >>^
      (\(x,y) -> Param {pnam=x, pval=y})) >. id))
    >>^
    (\(u,(w,(x,z))) -> ApplyTpl {tpl=x, output=u, ovar=w, params=z})
parseApplyTemplate :: (ArrowXml a) => a XmlTree TApplyTpl
parseApplyTemplate =
    ((hasAttr "output") <+> (hasAttr "var")) >>. (take 1)
    >>>
    ((parseMaybeAttr "output") &&& (parseMaybeAttr "var") &&& (getAttrValue0 "template")
     &&&
     ((getChildren >>> isElem >>> hasName "param"
      >>>
      ((getAttrValue0 "name") &&& (getAttrValue0 "value"))
      >>^
      (\(x,y) -> Param {pnam=x, pval=y})) >. id))
    >>^
    (\(u,(w,(x,z))) -> ApplyTpl {tpl=x, output=u, ovar=w, params=z})
parseApplyTemplate =
    ((hasAttr "output") <+> (hasAttr "var")) >>. (take 1)
    >>>
    ((parseMaybeAttr "output") &&& (parseMaybeAttr "var") &&& (getAttrValue0 "template")
     &&&
     ((getChildren >>> isElem >>> hasName "param"
      >>>
      ((getAttrValue0 "name") &&& (getAttrValue0 "value"))
      >>^
      (\(x,y) -> Param {pnam=x, pval=y})) >. id))
    >>^
    (\(u,(w,(x,z))) -> ApplyTpl {tpl=x, output=u, ovar=w, params=z})