child::*[self::chapter or self::appendix][position()=last()] selects the last chapter or appendix child of the context node