diff options
Diffstat (limited to 'test/transform/transformation.xsl')
-rw-r--r-- | test/transform/transformation.xsl | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/test/transform/transformation.xsl b/test/transform/transformation.xsl index ba17981..3582527 100644 --- a/test/transform/transformation.xsl +++ b/test/transform/transformation.xsl @@ -10,63 +10,59 @@ <xsl:import href="[testcase.xsl]"/> +<xsl:template name="writer"> + <xsl:param name="file"/> + <xsl:param name="content"/> + + <xsl:copy-of select="InputXSLT:write-file( + $file, + $content + )"/> +</xsl:template> + <xsl:template name="transformer"> + <xsl:param name="input"/> <xsl:param name="transformation"/> <xsl:param name="parameters"/> - <xsl:variable name="stylesheet" select="InputXSLT:read-file($transformation)"/> - - <xsl:choose> - <xsl:when test="$stylesheet/self::file/@result = 'success'"> - <transformation result="success"> - <xsl:copy-of select=" - InputXSLT:transform( - $stylesheet/self::file/*, - xalan:nodeset($parameters) - )/self::transformation/text() - "/> - </transformation> - </xsl:when> - <xsl:otherwise> - <transformation result="error"> - <xsl:copy-of select="$stylesheet/self::file/*"/> - </transformation> - </xsl:otherwise> - </xsl:choose> + <xsl:copy-of select="InputXSLT:transform( + $input, + $transformation, + $parameters + )"/> </xsl:template> <xsl:template name="generator"> + <xsl:param name="input"/> <xsl:param name="transformation"/> <xsl:param name="target"/> <xsl:param name="parameters"/> - <xsl:variable name="result"> + <xsl:variable name="transformerResult"> <xsl:call-template name="transformer"> - <xsl:with-param name="transformation" select="$transformation"/> - <xsl:with-param name="parameters" select="$parameters"/> + <xsl:with-param name="input" select="string($input)"/> + <xsl:with-param name="transformation" select="string($transformation)"/> + <xsl:with-param name="parameters" select="xalan:nodeset($parameters)"/> </xsl:call-template> </xsl:variable> - <xsl:choose> - <xsl:when test="xalan:nodeset($result)/transformation/@result = 'success'"> - <xsl:variable name="writeResult" select=" - InputXSLT:write-file( - $target, - xalan:nodeset($result)/transformation/text() - ) - "/> + <xsl:variable name="writerResult"> + <xsl:call-template name="writer"> + <xsl:with-param name="file" select="string($target)"/> + <xsl:with-param name="content" select="xalan:nodeset($transformerResult)/transformation/text()"/> + </xsl:call-template> + </xsl:variable> - <generator result="success" target="{$target}"/> - </xsl:when> - <xsl:otherwise> - <generator result="error" target="{$target}"/> - </xsl:otherwise> - </xsl:choose> + <generator transformation="{$transformation}" target="{$target}"> + <xsl:copy-of select="$transformerResult"/> + <xsl:copy-of select="$writerResult"/> + </generator> </xsl:template> <xsl:template name="implementation"> <xsl:variable name="result"> <xsl:call-template name="generator"> + <xsl:with-param name="input">[test.xml]</xsl:with-param> <xsl:with-param name="transformation">test.xsl</xsl:with-param> <xsl:with-param name="target">test_actual.xml</xsl:with-param> <xsl:with-param name="parameters"> @@ -75,8 +71,12 @@ </xsl:call-template> </xsl:variable> + <xsl:variable name="generator" select="xalan:nodeset($result)/generator"/> + <xsl:variable name="transformation" select="$generator/transformation/@result"/> + <xsl:variable name="write" select="$generator/file/@result"/> + <xsl:choose> - <xsl:when test="xalan:nodeset($result)/generator/@result = 'success'"> + <xsl:when test="$transformation = 'success' and $write = 'success'"> <xsl:copy-of select=" InputXSLT:read-file('test_actual.xml')/test_case/transform_test/* "/> |