public function setDocType($doctype,$called_from_macro)
    {
        // FIXME: this is temporary workaround for problem of DOCTYPE disappearing in cloned PHPTAL object (because clone keeps _parentContext)
        if (!$this->_docType) {
            $this->_docType = $doctype;
        }

        if ($this->_parentContext) {
            $this->_parentContext->setDocType($doctype, $called_from_macro);
        } else if ($this->_echoDeclarations) {
            if (!$called_from_macro) {
                echo $doctype;
            } else {
                throw new PHPTAL_ConfigurationException("Executed macro in file with DOCTYPE when using echoExecute(). This is not supported yet. Remove DOCTYPE or use PHPTAL->execute().");
            }
        }
        else if (!$this->_docType) {
            $this->_docType = $doctype;
        }
    }