diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/external_text_formatter/transformation.xsl | 19 | ||||
-rw-r--r-- | test/read_directory/transformation.xsl | 30 | ||||
-rw-r--r-- | test/read_file/transformation.xsl | 16 | ||||
-rw-r--r-- | test/read_xml_file/transformation.xsl | 20 | ||||
-rw-r--r-- | test/transform/transformation.xsl | 8 |
5 files changed, 70 insertions, 23 deletions
diff --git a/test/external_text_formatter/transformation.xsl b/test/external_text_formatter/transformation.xsl index 00fe3b3..a94f211 100644 --- a/test/external_text_formatter/transformation.xsl +++ b/test/external_text_formatter/transformation.xsl @@ -20,13 +20,24 @@ ) </xsl:variable> - <xsl:copy-of select="dyn:evaluate($command)/output/*"/> + <xsl:copy-of select="dyn:evaluate($command)"/> </xsl:template> <xsl:template name="implementation"> - <xsl:call-template name="formatter"> - <xsl:with-param name="source" select="InputXSLT:read-file('test.md')"/> - </xsl:call-template> + <xsl:variable name="result"> + <xsl:call-template name="formatter"> + <xsl:with-param name="source" select="InputXSLT:read-file('test.md')"/> + </xsl:call-template> + </xsl:variable> + + <xsl:choose> + <xsl:when test="xalan:nodeset($result)/output/@result = 'success'"> + <xsl:copy-of select="xalan:nodeset($result)/output/*"/> + </xsl:when> + <xsl:otherwise> + Failure during external text formatting + </xsl:otherwise> + </xsl:choose> </xsl:template> </xsl:stylesheet> diff --git a/test/read_directory/transformation.xsl b/test/read_directory/transformation.xsl index 9a9a057..f1446a2 100644 --- a/test/read_directory/transformation.xsl +++ b/test/read_directory/transformation.xsl @@ -2,22 +2,34 @@ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xalan="http://xml.apache.org/xalan" xmlns:InputXSLT="function.inputxslt.application" - exclude-result-prefixes="InputXSLT" + exclude-result-prefixes="InputXSLT xalan" > <xsl:include href="[testcase.xsl]"/> <xsl:template name="implementation"> - <xsl:for-each select="InputXSLT:read-directory('../')"> - <item type="{@type}"> - <name><xsl:value-of select="./name"/></name> + <xsl:variable name="result"> + <xsl:copy-of select="InputXSLT:read-directory('../')"/> + </xsl:variable> - <xsl:if test="@type='file' and ./name='check'"> - <extension><xsl:value-of select="./extension"/></extension> - </xsl:if> - </item> - </xsl:for-each> + <xsl:choose> + <xsl:when test="xalan:nodeset($result)/directory/@result = 'success'"> + <xsl:for-each select="xalan:nodeset($result)/directory/entry"> + <item type="{@type}"> + <name><xsl:value-of select="./name"/></name> + + <xsl:if test="@type='file' and ./name='check'"> + <extension><xsl:value-of select="./extension"/></extension> + </xsl:if> + </item> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + Error during directory io + </xsl:otherwise> + </xsl:choose> </xsl:template> </xsl:stylesheet> diff --git a/test/read_file/transformation.xsl b/test/read_file/transformation.xsl index f773e0e..9610046 100644 --- a/test/read_file/transformation.xsl +++ b/test/read_file/transformation.xsl @@ -2,14 +2,26 @@ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xalan="http://xml.apache.org/xalan" xmlns:InputXSLT="function.inputxslt.application" - exclude-result-prefixes="InputXSLT" + exclude-result-prefixes="InputXSLT xalan" > <xsl:include href="[testcase.xsl]"/> <xsl:template name="implementation"> - <xsl:value-of select="InputXSLT:read-file('test.txt')"/> + <xsl:variable name="result"> + <xsl:copy-of select="InputXSLT:read-file('test.txt')"/> + </xsl:variable> + + <xsl:choose> + <xsl:when test="xalan:nodeset($result)/file/@result = 'success'"> + <xsl:value-of select="xalan:nodeset($result)/file"/> + </xsl:when> + <xsl:otherwise> + Error during file io + </xsl:otherwise> + </xsl:choose> </xsl:template> </xsl:stylesheet> diff --git a/test/read_xml_file/transformation.xsl b/test/read_xml_file/transformation.xsl index 2a6c5e5..f23273e 100644 --- a/test/read_xml_file/transformation.xsl +++ b/test/read_xml_file/transformation.xsl @@ -2,16 +2,28 @@ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xalan="http://xml.apache.org/xalan" xmlns:InputXSLT="function.inputxslt.application" - exclude-result-prefixes="InputXSLT" + exclude-result-prefixes="InputXSLT xalan" > <xsl:include href="[testcase.xsl]"/> <xsl:template name="implementation"> - <xsl:for-each select="InputXSLT:read-xml-file('test.txt')/tester/eintrag"> - <item><xsl:value-of select="."/></item> - </xsl:for-each> + <xsl:variable name="result"> + <xsl:copy-of select="InputXSLT:read-xml-file('test.txt')"/> + </xsl:variable> + + <xsl:choose> + <xsl:when test="xalan:nodeset($result)/file/@result = 'success'"> + <xsl:for-each select="xalan:nodeset($result)/file/tester/eintrag"> + <item><xsl:value-of select="."/></item> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + Error during file io + </xsl:otherwise> + </xsl:choose> </xsl:template> </xsl:stylesheet> diff --git a/test/transform/transformation.xsl b/test/transform/transformation.xsl index 19c42ae..412036b 100644 --- a/test/transform/transformation.xsl +++ b/test/transform/transformation.xsl @@ -38,13 +38,13 @@ </xsl:variable> <xsl:choose> - <xsl:when test="xalan:nodeset($result)/result/error"> - <xsl:copy-of select="xalan:nodeset($result)/result/error"/> - </xsl:when> - <xsl:otherwise> + <xsl:when test="xalan:nodeset($result)/transformation/@result = 'success'"> <xsl:copy-of select=" InputXSLT:read-xml-file('test_actual.xml')/test_case/transform_test/* "/> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="xalan:nodeset($result)/transformation/*"/> </xsl:otherwise> </xsl:choose> </xsl:template> |