aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/steps/plan.xsl52
-rw-r--r--src/steps/process.xsl19
2 files changed, 49 insertions, 22 deletions
diff --git a/src/steps/plan.xsl b/src/steps/plan.xsl
index 653a9ca..88ecbdb 100644
--- a/src/steps/plan.xsl
+++ b/src/steps/plan.xsl
@@ -23,28 +23,13 @@
<xsl:param name="path"/>
<xsl:param name="node"/>
- <xsl:for-each select="$node/directory">
- <xsl:choose>
- <xsl:when test=".//file/@extension = '.xsl'">
- <xsl:call-template name="traverse">
- <xsl:with-param name="source" select="$source"/>
- <xsl:with-param name="target" select="$target"/>
- <xsl:with-param name="path" select="concat($path, '/', @name)"/>
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <task type="link">
- <from>
- <xsl:value-of select="concat($target, '/', $path, '/', @name)"/>
- </from>
- <to>
- <xsl:value-of select="concat($source, '/', $path, '/', @name)"/>
- </to>
- </task>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
+ <xsl:if test="count($node/file | $node/directory) &gt; 0">
+ <task type="directory">
+ <path>
+ <xsl:value-of select="concat($target, '/', $path)"/>
+ </path>
+ </task>
+ </xsl:if>
<xsl:for-each select="$node/file">
<xsl:choose>
@@ -75,6 +60,29 @@
</xsl:when>
</xsl:choose>
</xsl:for-each>
+
+ <xsl:for-each select="$node/directory">
+ <xsl:choose>
+ <xsl:when test=".//file/@extension = '.xsl'">
+ <xsl:call-template name="traverse">
+ <xsl:with-param name="source" select="$source"/>
+ <xsl:with-param name="target" select="$target"/>
+ <xsl:with-param name="path" select="concat($path, '/', @name)"/>
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <task type="link">
+ <from>
+ <xsl:value-of select="concat($target, '/', $path, '/', @name)"/>
+ </from>
+ <to>
+ <xsl:value-of select="concat($source, '/', $path, '/', @name)"/>
+ </to>
+ </task>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
</xsl:template>
<xsl:template match="datasource">
diff --git a/src/steps/process.xsl b/src/steps/process.xsl
index 29599f4..67c7f24 100644
--- a/src/steps/process.xsl
+++ b/src/steps/process.xsl
@@ -28,6 +28,14 @@
)/self::command/@result"/>
</xsl:template>
+<xsl:template name="create_directory">
+ <xsl:param name="path"/>
+
+ <xsl:value-of select="InputXSLT:external-command(
+ concat('mkdir --parents ./', $path)
+ )/self::command/@result"/>
+</xsl:template>
+
<xsl:template name="clean">
<xsl:param name="path"/>
@@ -268,4 +276,15 @@
</xsl:copy>
</xsl:template>
+<xsl:template match="task[@type = 'directory']">
+ <xsl:copy>
+ <xsl:attribute name="result">
+ <xsl:call-template name="create_directory">
+ <xsl:with-param name="path" select="path"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:copy-of select="@* | node()"/>
+ </xsl:copy>
+</xsl:template>
+
</xsl:stylesheet>