diff options
| -rw-r--r-- | process.xsl | 114 | 
1 files changed, 74 insertions, 40 deletions
diff --git a/process.xsl b/process.xsl index d8f2aab..a054965 100644 --- a/process.xsl +++ b/process.xsl @@ -17,47 +17,40 @@  <xsl:include href="utility/helper.xsl"/> -<xsl:template name="generate"> -	<xsl:param name="input"/> -	<xsl:param name="transformation"/> -	<xsl:param name="target"/> - -	<xsl:copy-of select="InputXSLT:generate( -		$input, -		$transformation, -		$target -	)/self::generation"/> -</xsl:template> - -<xsl:template name="linker"> +<xsl:template name="create_link">  	<xsl:param name="from"/>  	<xsl:param name="to"/> -	<linkage from="./{$from}" to="./{$to}" result="{InputXSLT:external-command( +	<xsl:value-of select="InputXSLT:external-command(  		concat('ln -sr ./', $to, ' ./', $from) -	)/self::command/@result}"/> +	)/self::command/@result"/>  </xsl:template> -<xsl:template name="cleaner"> +<xsl:template name="clean">  	<xsl:param name="path"/> -	<cleaning path="./{$path}" result="{InputXSLT:external-command( +	<xsl:value-of select="InputXSLT:external-command(  		concat('rm -r ./', $path, '/*') -	)/self::command/@result}"/> +	)/self::command/@result"/>  </xsl:template> -<xsl:template name="resolve_datasource"> -	<xsl:param name="datasource"/> +<xsl:template name="generate"> +	<xsl:param name="input"/> +	<xsl:param name="transformation"/> +	<xsl:param name="target"/> -	<xsl:for-each select="$datasource"> -		<xsl:element name="{@target}"> -			<xsl:choose> -				<xsl:when test="@mode = 'full'"> -					<xsl:copy-of select="InputXSLT:read-file(@source)/self::file/*/*"/> -				</xsl:when> -			</xsl:choose> -		</xsl:element> -	</xsl:for-each> +	<subtask> +		<xsl:attribute name="result"> +			<xsl:value-of select="InputXSLT:generate( +				$input, +				$transformation, +				$target +			)/self::generation/@result"/> +		</xsl:attribute> +		<target> +			<xsl:value-of select="$target"/> +		</target> +	</subtask>  </xsl:template>  <xsl:template name="resolve_target"> @@ -75,6 +68,20 @@  	</xsl:choose>  </xsl:template> +<xsl:template name="resolve_datasource"> +	<xsl:param name="datasource"/> + +	<xsl:for-each select="$datasource"> +		<xsl:element name="{@target}"> +			<xsl:choose> +				<xsl:when test="@mode = 'full'"> +					<xsl:copy-of select="InputXSLT:read-file(@source)/self::file/*/*"/> +				</xsl:when> +			</xsl:choose> +		</xsl:element> +	</xsl:for-each> +</xsl:template> +  <xsl:template name="compile">  	<xsl:param name="main"/>  	<xsl:param name="support"/> @@ -158,23 +165,50 @@  </xsl:template>  <xsl:template match="task[@type = 'clean']"> -	<xsl:call-template name="cleaner"> -		<xsl:with-param name="path" select="path"/> -	</xsl:call-template> +	<xsl:copy> +		<xsl:attribute name="result"> +			<xsl:call-template name="clean"> +				<xsl:with-param name="path" select="path"/> +			</xsl:call-template> +		</xsl:attribute> +		<xsl:copy-of select="@* | node()"/> +	</xsl:copy>  </xsl:template>  <xsl:template match="task[@type = 'generate']"> -	<xsl:call-template name="process"> -		<xsl:with-param name="source" select="source"/> -		<xsl:with-param name="target" select="target"/> -	</xsl:call-template> +	<xsl:variable name="results"> +		<xsl:call-template name="process"> +			<xsl:with-param name="source" select="source"/> +			<xsl:with-param name="target" select="target"/> +		</xsl:call-template> +	</xsl:variable> + +	<xsl:copy> +		<xsl:attribute name="result"> +			<xsl:choose> +				<xsl:when test="count(xalan:nodeset($results)/subtask[@result = 'success']) = count(xalan:nodeset($results)/subtask)"> +					<xsl:text>success</xsl:text> +				</xsl:when> +				<xsl:otherwise> +					<xsl:text>error</xsl:text> +				</xsl:otherwise> +			</xsl:choose> +		</xsl:attribute> +		<xsl:copy-of select="@* | source"/> +		<xsl:copy-of select="$results"/> +	</xsl:copy>  </xsl:template>  <xsl:template match="task[@type = 'link']"> -	<xsl:call-template name="linker"> -		<xsl:with-param name="from" select="from"/> -		<xsl:with-param name="to"   select="to"/> -	</xsl:call-template> +	<xsl:copy> +		<xsl:attribute name="result"> +			<xsl:call-template name="create_link"> +				<xsl:with-param name="from" select="from"/> +				<xsl:with-param name="to"   select="to"/> +			</xsl:call-template> +		</xsl:attribute> +		<xsl:copy-of select="@* | node()"/> +	</xsl:copy>  </xsl:template>  <xsl:template match="datasource">  | 
