Skip to content

Commit 5026764

Browse files
committed
[bugfix] Work around an issue with relative paths in XSLT imports when run from Elemental - see: evolvedbinary/elemental#169
1 parent bc19858 commit 5026764

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

pom.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,18 @@
101101
<excludes>
102102
<exclude>modules/git-sync.xql</exclude>
103103
<exclude>services/git-commit.xql</exclude>
104+
105+
<!-- NOTE(AR) This is temporary to allow us to fix up the xsl:import URIs
106+
using some XSLT from the xml-maven-plugin below.
107+
For example: xsl:import in Elemental
108+
does not yet correctly resolve:
109+
<xsl:import href="markdown-to-tei.xslt"/>
110+
relative to the importing stylesheet.
111+
See: https://github.com/evolvedbinary/elemental/issues/169
112+
-->
113+
<exclude>services/manuforma-form-to-tei.xslt</exclude>
114+
<exclude>services/tei-to-manuforma-form.xslt</exclude>
115+
104116
</excludes>
105117
<targetPath>xar-resources</targetPath>
106118
</resource>
@@ -235,6 +247,22 @@
235247
</parameters>
236248
<stylesheet>src/main/formGenerator/generateXForm.xsl</stylesheet>
237249
</transformationSet>
250+
251+
<transformationSet>
252+
<dir>src/main/xar-resources/services</dir>
253+
<includes>
254+
<include>manuforma-form-to-tei.xslt</include>
255+
<include>tei-to-manuforma-form.xslt</include>
256+
</includes>
257+
<parameters>
258+
<parameter>
259+
<name>db-collection-uri</name>
260+
<value>xmldb:exist:///db/apps/manuForma/services</value>
261+
</parameter>
262+
</parameters>
263+
<stylesheet>src/main/xslt/fix-xslt-imports-for-edb.xslt</stylesheet>
264+
<outputDir>${project.build.directory}/generated-xar-resources/services</outputDir>
265+
</transformationSet>
238266
</transformationSets>
239267
</configuration>
240268
</execution>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3+
xmlns:xs="http://www.w3.org/2001/XMLSchema"
4+
exclude-result-prefixes="xs"
5+
version="2.0">
6+
7+
<!-- The collection path URI in the database where the xsl:import can be resolved from -->
8+
<xsl:param name="db-collection-uri" as="xs:string" required="yes"/>
9+
10+
<xsl:template match="xsl:import">
11+
<xsl:copy>
12+
<xsl:attribute name="href" select="concat($db-collection-uri, '/', @href)"/>
13+
<xsl:apply-templates select="node()|@*[local-name(.) ne 'href']"/>
14+
</xsl:copy>
15+
</xsl:template>
16+
17+
<!-- Default: Identity trasform everything -->
18+
<xsl:template match="node()|@*">
19+
<xsl:copy>
20+
<xsl:apply-templates select="node()|@*"/>
21+
</xsl:copy>
22+
</xsl:template>
23+
24+
</xsl:stylesheet>

0 commit comments

Comments
 (0)