<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Hi George,</div><div><br></div><div>thanks for your quick response. It provides a useful workaround, but:&nbsp;</div><div><br></div><div><blockquote type="cite">[…] You pass an URI while that expects a file path. […]</blockquote></div><div><br></div><div>From The EXpath-Spec [1]:</div><div><br></div><div>»An implementation must accept absolute and relative UNIX/Linux and Windows paths as well as absolute&nbsp;file URIs.«</div><div><br></div><div>So I think it is OK to provide an absolute URI for the parameter.</div><div><br></div><div><br></div><div>BTW: My attempt to solve the issue in a more general way was&nbsp;file:path-to-native(), but it resolves the URI wrong. file:path-to-native("file:/Users/Stf/Documents/trash/file-exists.xsl") evaluates to »/Applications/oxygenXML 15.2/Users/Stf/Documents/trash/file-exists.xsl« (tested with the stylesheet [2]). Maybe this is the same problem as with file:exists().</div><div><br></div><div>Best regards,</div><div><br></div><div>Stefan</div><div><br></div><div>[1]&nbsp;<a href="http://expath.org/spec/file#file-paths">http://expath.org/spec/file#file-paths</a></div><div><br></div><div>[2] Modified test stylesheet:</div><div><br></div><div><div style="margin: 0px; color: rgb(171, 69, 0);"><span style="color: #9e44d3">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</span><span style="color: #000000"><br>
</span><span style="color: #0070c1">&lt;xsl:stylesheet</span><span style="color: #000000"><br>
</span><span style="color: #f9975e"><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #00aad6">xmlns:xsl</span><span style="color: #ff9450">=</span>"<a href="http://www.w3.org/1999/XSL/Transform">http://www.w3.org/1999/XSL/Transform</a>"<span style="color: #000000"><br>
</span><span style="color: #f9975e"><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #00aad6">xmlns:xs</span><span style="color: #ff9450">=</span>"<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>"<span style="color: #000000"><br>
</span><span style="color: #f9975e"><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #00aad6">xmlns:file</span><span style="color: #ff9450">=</span>"<a href="http://expath.org/ns/file">http://expath.org/ns/file</a>"<span style="color: #000000"><br>
</span><span style="color: #f9975e"><span class="Apple-tab-span" style="white-space:pre">        </span>version</span><span style="color: #ff9450">=</span>"2.0"<span style="color: #000000"><br>
</span><span style="color: #f9975e"><span class="Apple-tab-span" style="white-space:pre">        </span>exclude-result-prefixes</span><span style="color: #ff9450">=</span>"#all"<span style="color: #021da7">&gt;</span><span style="color: #000000"><br>
<span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #0070c1">&lt;xsl:template</span><span style="color: #f9975e"> match</span><span style="color: #ff9450">=</span>"/"<span style="color: #021da7">&gt;</span><span style="color: #000000"><br>
<span class="Apple-tab-span" style="white-space:pre">                </span></span><span style="color: #0070c1">&lt;xsl:variable</span><span style="color: #f9975e"> name</span><span style="color: #ff9450">=</span>"file"<span style="color: #f9975e"> as</span><span style="color: #ff9450">=</span>"xs:string"<span style="color: #f9975e"> select</span><span style="color: #ff9450">=</span>"string(document-uri(/))"<span style="color: #021da7">/&gt;</span><span style="color: #000000"><br>
<span class="Apple-tab-span" style="white-space:pre">                </span></span><span style="color: #021da7">&lt;root&gt;</span><span style="color: #000000"><br>
<span class="Apple-tab-span" style="white-space:pre">                        </span></span><span style="color: #021da7">&lt;test&gt;</span><span style="color: #000000"><br>
<span class="Apple-tab-span" style="white-space:pre">                                </span></span><span style="color: #0070c1">&lt;xsl:value-of</span><span style="color: #f9975e"> select</span><span style="color: #ff9450">=</span>"$file"<span style="color: #021da7">/&gt;</span><span style="color: #000000">: </span><span style="color: #0070c1">&lt;xsl:value-of</span><span style="color: #f9975e"> select</span><span style="color: #ff9450">=</span>"file:exists($file)"<span style="color: #021da7">/&gt;</span><span style="color: #000000"><br>
<span class="Apple-tab-span" style="white-space:pre">                        </span></span><span style="color: #021da7">&lt;/test&gt;</span><span style="color: #000000"><br>
<span class="Apple-tab-span" style="white-space:pre">                        </span></span><span style="color: #0070c1">&lt;xsl:variable</span><span style="color: #f9975e"> name</span><span style="color: #ff9450">=</span>"file2"<span style="color: #f9975e"> as</span><span style="color: #ff9450">=</span>"xs:string"<span style="color: #f9975e"> select</span><span style="color: #ff9450">=</span>"substring-after($file, 'file:')"<span style="color: #021da7">/&gt;</span><span style="color: #000000"><br>
<span class="Apple-tab-span" style="white-space:pre">                        </span></span><span style="color: #021da7">&lt;test&gt;</span><span style="color: #000000"><br>
<span class="Apple-tab-span" style="white-space:pre">                                </span></span><span style="color: #0070c1">&lt;xsl:value-of</span><span style="color: #f9975e"> select</span><span style="color: #ff9450">=</span>"$file2"<span style="color: #021da7">/&gt;</span><span style="color: #000000">: </span><span style="color: #0070c1">&lt;xsl:value-of</span><span style="color: #f9975e"> select</span><span style="color: #ff9450">=</span>"file:exists($file2)"<span style="color: #021da7">/&gt;</span><span style="color: #000000"><br>
<span class="Apple-tab-span" style="white-space:pre">                        </span></span><span style="color: #021da7">&lt;/test&gt;</span><span style="color: #000000"><br>
<span class="Apple-tab-span" style="white-space:pre">                        </span></span><span style="color: #0070c1">&lt;xsl:variable</span><span style="color: #f9975e"> name</span><span style="color: #ff9450">=</span>"file3"<span style="color: #f9975e"> as</span><span style="color: #ff9450">=</span>"xs:string"<span style="color: #f9975e"> select</span><span style="color: #ff9450">=</span>"file:path-to-native($file)"<span style="color: #021da7">/&gt;</span><span style="color: #000000"><br>
<span class="Apple-tab-span" style="white-space:pre">                        </span></span><span style="color: #021da7">&lt;test&gt;</span><span style="color: #000000"><br>
<span class="Apple-tab-span" style="white-space:pre">                                </span></span><span style="color: #0070c1">&lt;xsl:value-of</span><span style="color: #f9975e"> select</span><span style="color: #ff9450">=</span>"$file3"<span style="color: #021da7">/&gt;</span><span style="color: #000000">: </span><span style="color: #0070c1">&lt;xsl:value-of</span><span style="color: #f9975e"> select</span><span style="color: #ff9450">=</span>"file:exists($file3)"<span style="color: #021da7">/&gt;</span><span style="color: #000000"><br>
<span class="Apple-tab-span" style="white-space:pre">                        </span></span><span style="color: #021da7">&lt;/test&gt;</span><span style="color: #000000"><br>
<span class="Apple-tab-span" style="white-space:pre">                </span></span><span style="color: #021da7">&lt;/root&gt;</span><span style="color: #000000"><br>
<span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #0070c1">&lt;/xsl:template&gt;</span><span style="color: #000000"><br>
</span><span style="color: #0070c1">&lt;/xsl:stylesheet&gt;</span></div></div><div style="margin: 0px; color: rgb(171, 69, 0);"><br></div><div><div>Result:</div><div><br></div><div><div style="margin: 0px;"><span style="color: #021da7">&lt;root&gt;</span><br>
<span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #021da7">&lt;test&gt;</span>file:/Users/Stf/Documents/trash/file-exists.xsl: false<span style="color: #021da7">&lt;/test&gt;</span><br>
<span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #021da7">&lt;test&gt;</span>/Users/Stf/Documents/trash/file-exists.xsl: true<span style="color: #021da7">&lt;/test&gt;</span><br>
<span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #021da7">&lt;test&gt;</span>/Applications/oxygenXML 15.2/Users/Stf/Documents/trash/file-exists.xsl: false<span style="color: #021da7">&lt;/test&gt;</span><br>
<span style="color: #021da7">&lt;/root&gt;</span></div></div><div><br></div><div>Am 23.03.2014 um 08:43 schrieb George Cristian Bina &lt;<a href="mailto:george@oxygenxml.com">george@oxygenxml.com</a>&gt;:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi Stefan,<br><br>I think you are not passing the expected parameter to the file:exists function. You pass an URI while that expects a file path. For example, if I remove the "file:" part of the URI from the stylesheet then it returns true on my Mac:<br><br>&lt;xsl:stylesheet<br> &nbsp;xmlns:xsl="<a href="http://www.w3.org/1999/XSL/Transform">http://www.w3.org/1999/XSL/Transform</a>"<br> &nbsp;xmlns:xs="<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>"<br> &nbsp;xmlns:file="<a href="http://expath.org/ns/file">http://expath.org/ns/file</a>"<br> &nbsp;version="2.0"<br> &nbsp;exclude-result-prefixes="#all"&gt;<br> &nbsp;&lt;xsl:template match="/"&gt;<br> &nbsp;&nbsp;&nbsp;&lt;xsl:variable name="file" as="xs:string" select="string(document-uri(/))"/&gt;<br> &nbsp;&nbsp;&nbsp;&lt;test&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;xsl:value-of select="$file"/&gt;: &lt;xsl:value-of select="file:exists(substring-after($file, 'file:'))"/&gt;/&lt;xsl:value-of select="doc-available($file)"/&gt;<br> &nbsp;&nbsp;&nbsp;&lt;/test&gt;<br> &nbsp;&lt;/xsl:template&gt;<br>&lt;/xsl:stylesheet&gt;<br><br>--&gt;<br><br>&lt;test&gt;file:/Users/george/test/test.xsl: true/true&lt;/test&gt;<br><br>Best Regards,<br>George<br>--<br>George Cristian Bina<br>&lt;oXygen/&gt; XML Editor, Schema Editor and XSLT Editor/Debugger<br><a href="http://www.oxygenxml.com">http://www.oxygenxml.com</a><br><br>On 3/22/14, 3:15 PM, Stefan Krause wrote:<br><blockquote type="cite">Hi all,<br><br>I have the following stylesheet:<br><br>&lt;xsl:stylesheet<br>xmlns:xsl="http://www.w3.org/1999/XSL/Transform"<br>xmlns:xs="http://www.w3.org/2001/XMLSchema"<br>xmlns:file="http://expath.org/ns/file"<br>version="2.0"<br>exclude-result-prefixes="#all"&gt;<br>&lt;xsl:templatematch="/"&gt;<br>&lt;xsl:variablename="file"as="xs:string"select="string(document-uri(/))"/&gt;<br>&lt;test&gt;<br>&lt;xsl:value-ofselect="$file"/&gt;:<br>&lt;xsl:value-ofselect="file:exists($file)"/&gt;/&lt;xsl:value-ofselect="doc-available($file)"/&gt;<br>&lt;/test&gt;<br>&lt;/xsl:template&gt;<br>&lt;/xsl:stylesheet&gt;<br><br>I run it from OxygenXML with the stylesheet itself as the input document.<br><br>I expected the result is<br><br>&lt;test&gt;file:/Users/Stf/Documents/trash/file-exists.xsl: true/true&lt;/test&gt;<br><br>but actually it is<br><br>&lt;test&gt;file:/Users/Stf/Documents/trash/file-exists.xsl: false/true&lt;/test&gt;<br><br>Since I get the expected result from Oxygen on Windows, I think there is<br>something wrong with the Mac implementation.<br><br>I use XML Editor 15.2, build 2014022718 on Mac OS X 10.9.2 (13C64) with<br>java.version=1.6.0_65. The transformation scenario uses Saxon-PE, and<br>Saxon’s »-ext«-option is checked. There are no errors during the<br>transformation.<br><br>Any hints to get the right result?<br><br>Thank you,<br><br>Stefan<br><br><br><br><br><br><br>_______________________________________________<br>oXygen-user mailing list<br>oXygen-user@oxygenxml.com<br>http://www.oxygenxml.com/mailman/listinfo/oxygen-user<br><br></blockquote></blockquote></div><br></body></html>