aboutsummaryrefslogtreecommitdiff
path: root/src/steps/process.xsl
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-10-18 16:42:30 +0200
committerAdrian Kummerlaender2014-10-18 16:42:30 +0200
commita5b9f0faee9efdb950aa0558bb68cb320a9e72a4 (patch)
tree0c9f8762f4ad46a236fcd7d0de2a80ebb31ac204 /src/steps/process.xsl
parent6384ffbd42f34b3639d36623e27889a2781408c1 (diff)
downloadStaticXSLT-a5b9f0faee9efdb950aa0558bb68cb320a9e72a4.tar
StaticXSLT-a5b9f0faee9efdb950aa0558bb68cb320a9e72a4.tar.gz
StaticXSLT-a5b9f0faee9efdb950aa0558bb68cb320a9e72a4.tar.bz2
StaticXSLT-a5b9f0faee9efdb950aa0558bb68cb320a9e72a4.tar.lz
StaticXSLT-a5b9f0faee9efdb950aa0558bb68cb320a9e72a4.tar.xz
StaticXSLT-a5b9f0faee9efdb950aa0558bb68cb320a9e72a4.tar.zst
StaticXSLT-a5b9f0faee9efdb950aa0558bb68cb320a9e72a4.zip
Introduced new "directory" task type
* tasks of this type expect a path node providing the directory tree to be created ** the path is passed to `mkdir --parents $path` which does the actual work * this addition was introduced to fix failing `create_link` calls in cases where the link is created before the actual directory is created as a side-effect of `InputXSLT:generate` ** this side-effect causes `InputXSLT:generate` to be impure and should be elimniated in InputXSLT if possible *** the current hindrance preventing me from doing just that are the `xpath` target declarations which depend on this behaviour
Diffstat (limited to 'src/steps/process.xsl')
-rw-r--r--src/steps/process.xsl19
1 files changed, 19 insertions, 0 deletions
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>