Hi,
I would like to test if an image online exists.
I have read this
XSLT Check if directory exist and also a suggestion
here
but still there is something i must be getting wrong (please also note that I have never worked with java).
my xslt (Saxon 9.5.1.3) works on a local file and needs to check the existence of this file building the url on the basis of a varible, like this:
source:
Code:
<list>
<ROW RECORDID="373"/>
</list>
Code:
<xsl:function name="java:file-exists" xmlns:file="java.io.File" as="xs:boolean">
<xsl:param name="file" as="xs:string"/>
<xsl:param name="base-uri" as="xs:string"/>
<xsl:variable name="absolute-uri" select="resolve-uri($file, $base-uri)" as="xs:anyURI"/>
<xsl:sequence select="file:exists(file:new($absolute-uri))"/>
</xsl:function>
...
<xsl:template match="ROW">
<xsl:variable name="URI">
<xsl:value-of select="concat('http://foo.xx/detail-base.php?image=Image_5_Large&recid=', @RECORDID)"/>
</xsl:variable>
<xsl:if test="java:file-exists($URI, base-uri())">
<graphic url="{$URI}"/></xsl:if>
...
</xsl:template>
the error I get is:
Quote:
|
jt:java.lang.IllegalArgumentException: Exception thrown by extension function {public java.io.File(java.net.URI)}: java.lang.IllegalArgumentException: URI scheme is not "file"
|
and I do not understand it.
Any help would be greatly appreciated.
Thank you very much
Pietro