Bug document: fdo67478-1.doc The replace-spaces template consumed one pair of spaces per recursion level. WordML documents with very long space runs (e.g. 61000 consecutive spaces) exceeded libxslt's 3000 depth limit, causing an import error. Consume the entire consecutive space run in a single call by using translate() to find the first non-space character, counting all leading spaces at once, and emitting a single <text:s text:c="N"/> element. Recursion depth is now bounded by the number of separate space runs, not the total number of spaces. Change-Id: Ifb11a61a2e89274684e1d6d38920c8792598fa43 Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/62 Reviewed-by: Michael Stahl <michael.stahl@collabora.com> Tested-by: Jenkins CPCI <releng@collaboraoffice.com> (cherry picked from commit 7ba970bce9e1200e5712afe76ec3a85056be9263) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204666 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>