protected function resolveXmlBase()
    {
        $stack = $this->getXmlBaseStack();
        $stack->rewind();

        $resolvedBase = '';

        while ($stack->valid() === true) {

            if (($currentBase = $stack->current()) !== '') {
                if ($resolvedBase === '') {
                    $resolvedBase = $currentBase;
                } else {
                    $resolvedBase = Url::rtrim($currentBase) . '/' . Url::ltrim($resolvedBase);
                }
            }

            $stack->next();
        }

        if ($stack->count() > 0) {
            $stack->pop();
        }

        return $resolvedBase;
    }