diff options
author | Adrian Kummerländer | 2014-05-31 14:18:48 +0200 |
---|---|---|
committer | Adrian Kummerländer | 2014-05-31 14:18:48 +0200 |
commit | 1a744712426c9c19019b8ebebdd0c703aae204a6 (patch) | |
tree | fd82b4e5b0e53b39dd0d9df5e5dda6aa0f050eb0 /test/read_directory | |
parent | d5367d268e8f2be9dd519b3b90f7baa64d6d50b7 (diff) | |
download | InputXSLT-1a744712426c9c19019b8ebebdd0c703aae204a6.tar InputXSLT-1a744712426c9c19019b8ebebdd0c703aae204a6.tar.gz InputXSLT-1a744712426c9c19019b8ebebdd0c703aae204a6.tar.bz2 InputXSLT-1a744712426c9c19019b8ebebdd0c703aae204a6.tar.lz InputXSLT-1a744712426c9c19019b8ebebdd0c703aae204a6.tar.xz InputXSLT-1a744712426c9c19019b8ebebdd0c703aae204a6.tar.zst InputXSLT-1a744712426c9c19019b8ebebdd0c703aae204a6.zip |
Revamped external function result trees
* the root node of the result tree of each function is a domain element
** i.e. the root node of "read-xml-file" is "file", the root node of "read-directory" is "directory"
* the root node contains the result state of the function call encoded in a "result" attribute
** possible values are "success" and "error"
** the root node may contain additional attributes such as the target path of a called transformation
* the actual function result is contained within the child nodes of the function root node
** i.e. the XML file tree returned by "read-xml-file" is a child of the function root node
** if specific errors occured they are also returned as child nodes of the function root node
*** this is currently only the case for "transform" where transformation errors are returned as "error" value node childs of the function root node
* updated test cases accordingly
Diffstat (limited to 'test/read_directory')
-rw-r--r-- | test/read_directory/transformation.xsl | 30 |
1 files changed, 21 insertions, 9 deletions
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> |