/* The descend argument controls whether the previous node's last child is considered to be the previous node. The top node argument constrains the walk to the node's children.  */
mxml_node_t* mxmlWalkPrev(mxml_node_t *node, mxml_node_t *top, int descend)
/* The descend argument controls whether the previous node's last child is considered to be the previous node. The top node argument constrains the walk to the node's children.  */
mxml_node_t* mxmlWalkPrev(mxml_node_t *node, mxml_node_t *top, int descend)
{
  if (!node || node == top)
    return (NULL);
  else if (node->prev)
  {
    if (node->prev->last_child && descend)
    {
      node = node->prev->last_child;
      while (node->last_child)
        node = node->last_child;
      return (node);
    }
    else
      return (node->prev);
  }
  else if (node->parent != top)
    return (node->parent);
  else
    return (NULL);
}