diff --git a/filter/CustomTarget_docbook.mk b/filter/CustomTarget_docbook.mk
new file mode 100644
index 000000000000..4221a5fefcc1
--- /dev/null
+++ b/filter/CustomTarget_docbook.mk
@@ -0,0 +1,55 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CustomTarget_CustomTarget,filter/source/docbook))
+
+filter_docbook_files := \
+ DocBookTemplate/settings.xml \
+ DocBookTemplate/manifest.rdf \
+
+
+filter_docbook_files_RELATIVE = $(subst $(1)/,,$(filter $(1)/%,$(filter_docbook_files)))
+
+define run_zip_docbook_recipe =
+$(call gb_Output_announce,$(subst $(gb_CustomTarget_workdir)/filter/source/docbook/,,$@),$(true),ZIP,2)
+$(call gb_Trace_StartRange,$(subst $(gb_CustomTarget_workdir)/filter/source/docbook/,,$@),ZIP)
+cd $(dir $<) && \
+$(call gb_Helper_wsl_path,\
+$(WSL) zip -q0X --filesync --must-match $@ mimetype && \
+$(WSL) zip -qrX --must-match $@ $(subst $(dir $<),,$^)) -x mimetype
+$(call gb_Trace_EndRange,$(subst $(gb_CustomTarget_workdir)/filter/source/docbook/,,$@),ZIP)
+endef
+
+.SECONDEXPANSION:
+# secondexpansion since the patterns not just cover a filename portion, but also include a
+# directory portion with different number of elements
+# copy regular files (mimetype, *.jpg, *.png, *.rdf, *.svg, *.svm, …)
+$(gb_CustomTarget_workdir)/filter/source/docbook/% : $(SRCDIR)/filter/source/docbook/% \
+ | $$(dir $(gb_CustomTarget_workdir)/filter/source/docbook/$$*).dir
+ $(call gb_Output_announce,docbook/$*,$(true),CPY,1)
+ $(call gb_Trace_StartRange,docbook/$*,CPY)
+ cp $< $@
+ $(call gb_Trace_EndRange,docbook/$*,CPY)
+
+# test and copy xml files
+$(gb_CustomTarget_workdir)/filter/source/docbook/%.xml : $(SRCDIR)/filter/source/docbook/%.xml \
+ | $(call gb_ExternalExecutable_get_dependencies,xsltproc) \
+ $$(dir $(gb_CustomTarget_workdir)/filter/source/docbook/$$*.xml).dir
+ $(call gb_Output_announce,docbook/$*.xml,$(true),XSL,1)
+ $(call gb_Trace_StartRange,docbook/$*.xml,XSL)
+ $(call gb_ExternalExecutable_get_command,xsltproc) --nonet -o $@ $(SRCDIR)/extras/util/compact.xsl $<
+ $(call gb_Trace_EndRange,docbook/$*.xml,XSL)
+
+$(gb_CustomTarget_workdir)/filter/source/docbook/%.ott : \
+ $$(addprefix $(gb_CustomTarget_workdir)/filter/source/docbook/$$*/,\
+ mimetype META-INF/manifest.xml styles.xml \
+ $$(call filter_docbook_files_RELATIVE,$$*))
+ $(run_zip_docbook_recipe)
+
+# vim: set noet sw=4 ts=4:
diff --git a/filter/Module_filter.mk b/filter/Module_filter.mk
index c28c72705cec..a2cf70628bec 100644
--- a/filter/Module_filter.mk
+++ b/filter/Module_filter.mk
@@ -21,6 +21,7 @@ $(eval $(call gb_Module_Module,filter))
$(eval $(call gb_Module_add_targets,filter,\
Configuration_filter \
CustomTarget_svg \
+ CustomTarget_docbook \
Library_filterconfig \
Library_icg \
Library_msfilter \
diff --git a/filter/Package_docbook.mk b/filter/Package_docbook.mk
index 6548fd6a1fd9..6c1a454a87ad 100644
--- a/filter/Package_docbook.mk
+++ b/filter/Package_docbook.mk
@@ -16,10 +16,10 @@
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
-$(eval $(call gb_Package_Package,filter_docbook,$(SRCDIR)/filter/source/docbook))
+$(eval $(call gb_Package_Package,filter_docbook,$(gb_CustomTarget_workdir)/filter/source/docbook))
$(eval $(call gb_Package_add_files,filter_docbook,$(LIBO_SHARE_FOLDER)/xslt/docbook,\
- DocBookTemplate.stw \
+ DocBookTemplate.ott \
docbooktosoffheadings.xsl \
sofftodocbookheadings.xsl \
))
diff --git a/filter/source/config/fragments/filters/DocBook_File.xcu b/filter/source/config/fragments/filters/DocBook_File.xcu
index da278f4c688f..6f7a4a66fa3f 100644
--- a/filter/source/config/fragments/filters/DocBook_File.xcu
+++ b/filter/source/config/fragments/filters/DocBook_File.xcu
@@ -22,7 +22,7 @@
com.sun.star.documentconversion.XSLTFilter,,com.sun.star.comp.Writer.XMLImporter,com.sun.star.comp.Writer.XMLExporter,../$(share_subdir_name)/xslt/docbook/docbooktosoffheadings.xsl,../$(share_subdir_name)/xslt/docbook/sofftodocbookheadings.xsl
com.sun.star.comp.Writer.XmlFilterAdaptor
- ../$(share_subdir_name)/xslt/docbook/DocBookTemplate.stw
+ ../$(share_subdir_name)/xslt/docbook/DocBookTemplate.ott
DocBook
diff --git a/filter/source/docbook/DocBookTemplate.stw b/filter/source/docbook/DocBookTemplate.stw
deleted file mode 100644
index ebc95f9f68cb..000000000000
Binary files a/filter/source/docbook/DocBookTemplate.stw and /dev/null differ
diff --git a/filter/source/docbook/DocBookTemplate/META-INF/manifest.xml b/filter/source/docbook/DocBookTemplate/META-INF/manifest.xml
new file mode 100644
index 000000000000..170a211048b8
--- /dev/null
+++ b/filter/source/docbook/DocBookTemplate/META-INF/manifest.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/filter/source/docbook/DocBookTemplate/manifest.rdf b/filter/source/docbook/DocBookTemplate/manifest.rdf
new file mode 100644
index 000000000000..c0d8477ec660
--- /dev/null
+++ b/filter/source/docbook/DocBookTemplate/manifest.rdf
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/filter/source/docbook/DocBookTemplate/mimetype b/filter/source/docbook/DocBookTemplate/mimetype
new file mode 100644
index 000000000000..6a297d887997
--- /dev/null
+++ b/filter/source/docbook/DocBookTemplate/mimetype
@@ -0,0 +1 @@
+application/vnd.oasis.opendocument.text-template
\ No newline at end of file
diff --git a/filter/source/docbook/DocBookTemplate/settings.xml b/filter/source/docbook/DocBookTemplate/settings.xml
new file mode 100644
index 000000000000..885ffd5aafc6
--- /dev/null
+++ b/filter/source/docbook/DocBookTemplate/settings.xml
@@ -0,0 +1,24 @@
+
+
+
+
+ true
+ true
+ true
+ true
+ false
+ true
+ false
+ true
+ false
+ false
+ false
+ false
+ true
+ high-resolution
+ false
+ true
+ false
+
+
+
diff --git a/filter/source/docbook/DocBookTemplate/styles.xml b/filter/source/docbook/DocBookTemplate/styles.xml
new file mode 100644
index 000000000000..63baba2a55bc
--- /dev/null
+++ b/filter/source/docbook/DocBookTemplate/styles.xml
@@ -0,0 +1,355 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+