W3C home > Mailing lists > Public > www-xsl-fo@w3.org > September 2007

RE: external-graphic

From: Vladimir Rodimyuk <VladimirR@ukrinvent.com>
Date: Fri, 14 Sep 2007 14:30:29 +0300
To: axdmoraes <alexmoraes@gmail.com>, "www-xsl-fo@w3.org" <www-xsl-fo@w3.org>
Message-ID: <C50378BB9C267D4796753862ED9AE1A346BFE5F954@UI-OPTERON.ukrinvent.com>
Hi Alexandre,

Well, mea culpa, I posted a link to recipe for Saxon 8 processor which is not used by XEP. The XEP formatter is using Saxon 6.5.

Anyway the posted link is a successor of the thread that does contain a solution for your problem. See here: http://www.biglist.com/lists/xsl-list/archives/200006/msg01332.html

Here is a snippet ready to use.

  <xsl:template name="file.check" xmlns:file="java.io.File" >
    <xsl:param name="filename" />
    <xsl:choose>
      <xsl:when test="function-available('file:new')">
         <xsl:variable name="fileobj"
           select="file:new($filename)" />
         <xsl:choose>
            <xsl:when test="not(file:exists($fileobj))">
                <xsl:value-of select="true()"/>
                <xsl:message>
                  <xsl:text>File name=&apos;</xsl:text>
                    <xsl:value-of select="$filename" />
                  <xsl:text>&apos; exists.</xsl:text>
                </xsl:message>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="false()"/>
                <xsl:message>
                  <xsl:text>File name=&apos;</xsl:text>
                    <xsl:value-of select="$filename" />
                  <xsl:text>&apos; does not exist.</xsl:text>
                </xsl:message>
            </xsl:otherwise>
        </xsl:choose>
      </xsl:when>
      <xsl:otherwise>
        <xsl:message>
          <xsl:text>WARNING : unable to call function &apos;file:new&apos;</xsl:text>
        </xsl:message>
      </xsl:otherwise>
   </xsl:choose>
  </xsl:template>

See attached stylesheet for example how to use it.

Respectfully,
Volodymyr Rodymyuk

> -----Original Message-----
> From: www-xsl-fo-request@w3.org [mailto:www-xsl-fo-request@w3.org] On
> Behalf Of axdmoraes
> Sent: Thursday, September 13, 2007 3:57 PM
> To: www-xsl-fo@w3.org
> Subject: Re: external-graphic
>  Iīm using xep 4.10..
> Alexandre
> Tony Graham-3 wrote:
> >>             I tryed this:
> >>
> >>           <xsl:variable name="absoluteURI" select="resolve-uri(@src,
> >> base-uri(.))" as="xs:anyURI"/>
> >>           But it didnīt work.
> > resolve-uri() is an XPath 2.0 function, and it appears that you are
> > using an XSLT 1.0 processor since it doesn't recognise the "as"
> > attribute.
> >
> > To use Michael Kay's example in his XSL-List post, you would need a
> > Java-based XSLT 2.0 processor (such as Michael Kay's 'Saxon').
> >
> > Tony Graham.



Received on Friday, 14 September 2007 11:36:12 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:06:15 GMT