diff --git a/configure-xinclude-handling.xsl b/configure-xinclude-handling.xsl
new file mode 100644
index 0000000000000000000000000000000000000000..d85820cd4ddf558750ebe02d4d2b25feaf7c3411
--- /dev/null
+++ b/configure-xinclude-handling.xsl
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no" doctype-public="-//Jetty//Configure//EN" doctype-system="http://www.eclipse.org/jetty/configure_9_3.dtd"/>
+    <xsl:param name="configParam"/>
+    
+    <xsl:template match="@* | node()">
+        <xsl:copy>
+            <xsl:apply-templates select="@* | node()"/>
+        </xsl:copy>
+    </xsl:template>
+      
+    <xsl:template match="@enable-xinclude">
+        <xsl:attribute name="enable-xinclude">
+            <xsl:value-of select="$configParam"/>
+        </xsl:attribute>
+    </xsl:template>
+</xsl:stylesheet>
diff --git a/generic.build.properties b/generic.build.properties
index bd9a587f5217b7f9156a917ba014b96877abb14e..3c0e004ce92755964737d2df75b16cfe95bb5273 100644
--- a/generic.build.properties
+++ b/generic.build.properties
@@ -16,6 +16,7 @@ exist.tag=eXist-${exist.version}
 exist.dest=${build.dir}/exist
 exist.dist=${exist.dest}/dist/eXist-db-${exist.version}
 exist.memory=2048
+exist.enable-xinclude=no
 
 # Jetty port configuration
 jetty.http.port=8080
diff --git a/generic.xml b/generic.xml
index fdcbde3702a5a83636c58c275cc1c332b4744383..dcb0f7b1b19a6cdee9906cac064f5fbd5afd2cc1 100644
--- a/generic.xml
+++ b/generic.xml
@@ -83,53 +83,69 @@
         </replace>
 
     </target>
-  
+
     <target name="sade-memory" depends="exist-dist-conf">
-      <replace file="${build.dir}/sade/bin/functions.d/eXist-settings.sh" 
-        token="Xmx2048m" 
+      <replace file="${build.dir}/sade/bin/functions.d/eXist-settings.sh"
+        token="Xmx2048m"
         value="Xmx${exist.memory}m"/>
-      
+
       <echo>Total memory available for SADE's eXist-db: ${exist.memory}.</echo>
     </target>
 
     <!-- Port configuration -->
     <target name="jetty-port" depends="prepare-dist-dir">
       <!-- HTTP port -->
-      <xslt 
-        in="${build.dir}/sade/tools/jetty/etc/jetty-http.xml" 
-        out="${build.dir}/sade/tools/jetty/etc/jetty-http-tmp.xml" 
-        style="jetty-port-update.xsl">   
+      <xslt
+        in="${build.dir}/sade/tools/jetty/etc/jetty-http.xml"
+        out="${build.dir}/sade/tools/jetty/etc/jetty-http-tmp.xml"
+        style="jetty-port-update.xsl">
         <param name="customPort" expression="${jetty.http.port}"/>
       </xslt>
-      <move 
-        file="${build.dir}/sade/tools/jetty/etc/jetty-http-tmp.xml" 
+      <move
+        file="${build.dir}/sade/tools/jetty/etc/jetty-http-tmp.xml"
         tofile="${build.dir}/sade/tools/jetty/etc/jetty-http.xml"/>
-      
+
       <!-- HTTPS port -->
-      <xslt 
-        in="${build.dir}/sade/tools/jetty/etc/jetty-ssl.xml" 
-        out="${build.dir}/sade/tools/jetty/etc/jetty-ssl-tmp.xml" 
-        style="jetty-port-update.xsl">   
+      <xslt
+        in="${build.dir}/sade/tools/jetty/etc/jetty-ssl.xml"
+        out="${build.dir}/sade/tools/jetty/etc/jetty-ssl-tmp.xml"
+        style="jetty-port-update.xsl">
         <param name="customPort" expression="${jetty.https.port}"/>
       </xslt>
-      <move 
-        file="${build.dir}/sade/tools/jetty/etc/jetty-ssl-tmp.xml" 
+      <move
+        file="${build.dir}/sade/tools/jetty/etc/jetty-ssl-tmp.xml"
         tofile="${build.dir}/sade/tools/jetty/etc/jetty-ssl.xml"/>
-      
-      <xslt 
-        in="${build.dir}/sade/tools/jetty/etc/jetty.xml" 
-        out="${build.dir}/sade/tools/jetty/etc/jetty-tmp.xml" 
-        style="jetty-port-update.xsl">   
+
+      <xslt
+        in="${build.dir}/sade/tools/jetty/etc/jetty.xml"
+        out="${build.dir}/sade/tools/jetty/etc/jetty-tmp.xml"
+        style="jetty-port-update.xsl">
         <param name="customPort" expression="${jetty.https.port}"/>
       </xslt>
-      <move 
-        file="${build.dir}/sade/tools/jetty/etc/jetty-tmp.xml" 
+      <move
+        file="${build.dir}/sade/tools/jetty/etc/jetty-tmp.xml"
         tofile="${build.dir}/sade/tools/jetty/etc/jetty.xml"/>
-      
+
       <echo>Jetty HTTP port is set to ${jetty.http.port}.</echo>
       <echo>Jetty HTTPS port is set to ${jetty.https.port}.</echo>
     </target>
 
+
+    <target name="configure-xinclude-handling" depends="prepare-dist-dir">
+        <xslt
+            in="${build.dir}/sade/conf.xml"
+            out="${build.dir}/sade/conf-tmp.xml"
+            style="configure-xinclude-handling.xsl">
+            <param name="configParam" expression="${exist.enable-xinclude}"/>
+        </xslt>
+        <move
+            file="${build.dir}/sade/conf-tmp.xml"
+            tofile="${build.dir}/sade/conf.xml"/>
+
+        <echo>Are XIncludes expanded automatically? ${exist.enable-xinclude}.</echo>
+    </target>
+
+
     <target name="prepare-dist-dir" depends="exist-dist-conf">
         <delete dir="${build.dir}/sade"/>
         <!-- get updated xars to autodeploy dir -->
@@ -151,7 +167,7 @@
     </target>
 
     <!-- SADE -->
-    <target name="sade" depends="prepare-dist-dir, sade-assets, sade-memory, jetty-port">
+    <target name="sade" depends="prepare-dist-dir, sade-assets, sade-memory, jetty-port, configure-xinclude-handling">
         <git repo="${sade.git}" branch="${sade.branch}" dest="${sade.dest}"/>
         <ant antfile="${sade.dest}/build.xml" inheritAll="false"/>
         <move2autodeploy source="${sade.dest}/build/"/>