aboutsummaryrefslogtreecommitdiff
path: root/dummy
diff options
context:
space:
mode:
authorAdrian Kummerländer2014-04-26 20:06:17 +0200
committerAdrian Kummerländer2014-04-26 20:06:17 +0200
commiteba5513f82f0e1458543e8646db0317d7211cf96 (patch)
tree67b0238322b10d34c5caf45200aae1cbd548a7b0 /dummy
parent7e7b112e6c00bcce0b339652748079cf7c9f1430 (diff)
downloadInputXSLT-eba5513f82f0e1458543e8646db0317d7211cf96.tar
InputXSLT-eba5513f82f0e1458543e8646db0317d7211cf96.tar.gz
InputXSLT-eba5513f82f0e1458543e8646db0317d7211cf96.tar.bz2
InputXSLT-eba5513f82f0e1458543e8646db0317d7211cf96.tar.lz
InputXSLT-eba5513f82f0e1458543e8646db0317d7211cf96.tar.xz
InputXSLT-eba5513f82f0e1458543e8646db0317d7211cf96.tar.zst
InputXSLT-eba5513f82f0e1458543e8646db0317d7211cf96.zip
Converted external read-file function output into a node set
* A call to _read-file_ now returns a _content_ and _status_ node ** this enables XSL transformations to easily react to io related errors * fixed bug in path resolution ** boost::filesystem _canonical_ method is throwing and exception when the given path does not exist, this pulled down the whole stack ** replaced call to _canonical_ with call to _absolute_ which does not have this requirement
Diffstat (limited to 'dummy')
-rw-r--r--dummy/transform.xsl25
1 files changed, 15 insertions, 10 deletions
diff --git a/dummy/transform.xsl b/dummy/transform.xsl
index 62d28c2..323ecdb 100644
--- a/dummy/transform.xsl
+++ b/dummy/transform.xsl
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet version="1.0"
+<xsl:stylesheet
+ version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:external="http://ExternalFunction.xalan-c++.xml.apache.org">
+ xmlns:external="http://ExternalFunction.xalan-c++.xml.apache.org"
+>
<xsl:output method="xml"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
@@ -16,24 +18,27 @@
</head>
<body>
<div id="raw">
- <xsl:value-of select="external:read-file('test.txt')" />
+ <xsl:variable name="testFile" select="external:read-file('test.txt')"/>
+ <xsl:choose>
+ <xsl:when test="$testFile/self::status = 'successful'">
+ <xsl:value-of select="$testFile/self::content"/>
+ </xsl:when>
+ <xsl:otherwise>
+ Failed to read test.txt
+ </xsl:otherwise>
+ </xsl:choose>
</div>
<ul id="xml">
<xsl:for-each select="external:read-xml-file('test.txt')/tester/eintrag">
<li><xsl:value-of select="."/></li>
</xsl:for-each>
</ul>
- <ul id="filelist">
- <xsl:for-each select="external:read-directory('.')[@type='file']">
- <li><xsl:value-of select="."/></li>
- </xsl:for-each>
- </ul>
- <ul id="filelist2">
+ <ul id="filelist1">
<xsl:for-each select="external:read-directory('../')[@type='file']">
<li><xsl:value-of select="."/></li>
</xsl:for-each>
</ul>
- <ul id="filelist3">
+ <ul id="filelist2">
<xsl:for-each select="external:read-directory('../')[@type='directory']">
<li><xsl:value-of select="."/></li>
</xsl:for-each>