Bir HTML dosyasının bulunup bulunmadığını XSLT'de kontrol etmek istiyorum. Bunu nasıl yapabilirim? Dosya-exists.xsl dosyasını zaten denedim https://gist.github.com/emth/4531924 ama benim için çalışmıyor. Şu an 2 saatten fazla koşmaya çalışıyorum ama sıkıştım. İşte benim karınca pasajı var:XSLT'de bir dosya varlığını nasıl kontrol edebilirim?
<target name="transform">
<xslt in="/tmp/sample.xml" out="/tmp/out.html" style="/tmp/sample.xsl" />
</target>
ve bu benim xslt dosyasıdır:
[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
Can: aşağıdaki hatayı alırsınız karınca ile bu Running
<?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>
....
Herkes bana bir örnek veriyor mu yoksa başka bir alternatif var mı? Teşekkürler!
2.0 Ben kütüphane dosya exists.xsl kullanım XSL engin adlı 2.0 düşünüyorsun ama sürüm 1.0 çalıştırmak http://stackoverflow.com/questions/2917655/how-do-i-check-for-the-existence-of-an-external-file-with-xsl – Sawyer
Sürüm 1.0 veya 2.0 kullanıp kullanmam fark etmez . Aynı hatayı 2.0 – user1613270