मैं एक्सएसएलटी में जांचना चाहता हूं कि कोई HTML फ़ाइल मौजूद है या नहीं। मैं यह कैसे कर सकता हूं? मैंने पहले ही https://gist.github.com/emth/4531924 से फ़ाइल-exist.xsl को आजमाया है लेकिन यह मेरे लिए काम नहीं करता है। मैं इसे 2 घंटे से अधिक समय तक चलाने की कोशिश कर रहा हूं, लेकिन मैं अटक गया हूं। यहाँ मेरी चींटी का टुकड़ा है:मैं एक्सएसएलटी में फ़ाइल अस्तित्व की जांच कैसे कर सकता हूं?
<target name="transform">
<xslt in="/tmp/sample.xml" out="/tmp/out.html" style="/tmp/sample.xsl" />
</target>
और यह मेरा xslt फ़ाइल है:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:java="http://www.java.com/">
<xsl:import href="file-exists.xsl"/>
...
<xsl:if test="java:file-exists('myfile.html', base-uri())">
<!-- do something here... -->
</xsl:if>
....
चींटी मैं निम्न त्रुटि मिल जाएगा के साथ इस चल रहा है:
[xslt] Processing /tmp/sample.xml to /tmp/out.html
[xslt] Loading stylesheet /tmp/sample.xsl
[xslt] : Error! The first argument to the non-static Java function 'fileExists' is not a valid object reference.
[xslt] : Error! Cannot convert data-type 'void' to 'boolean'.
[xslt] : Fatal Error! Could not compile stylesheet
[xslt] Failed to process /tmp/sample.xml
कर सकते हैं कोई मुझे एक चल रहा उदाहरण प्रदान करता है या कोई अन्य विकल्प है? धन्यवाद!
मुझे लगता है कि पुस्तकालय फ़ाइल exists.xsl उपयोग XSL उद्योगों 2.0 लेकिन आप संस्करण 1.0 में इसे चलाने http://stackoverflow.com/questions/2917655/how-do-i-check-for-the-existence-of-an-external-file-with-xsl – Sawyer
इससे कोई फर्क नहीं पड़ता कि मैं संस्करण 1.0 या 2.0 का उपयोग करता हूं । मुझे 2.0 – user1613270