maybe this could help (attached fix-imagelinks.xsl)  ;-)

cheers,

Marc

Omer Kamal a écrit :

I am creating PDF with Cocoon 2.1.6 .I am having a problem with <fo: external-graphics> tag.

I can’t see the image in my document.

Some body advised me to use absolute path but I am not sure how it works in Cocoon.
I am sure there is some unique way to do it.


I tried with many option but don’t know why it not works.
My that part of code view for some options is as under;

(1)

*<fo: static-content flow-name="xsl-region-before">

<fo: block>
<fo: external-graphics width="1.75in" src=url"('file://\C:\Program Files\cocoon-2.1.6\build\webapp\mypdf\canadaflag.jpg')"/>


</fo: block>*

/* tried also without single coots in the braces and without using file://\ <file:///%5C%5C> thing.
/
(2)




*<fo: static-content flow-name="xsl-region-before">

<fo:block>
<fo:external-graphics width="200px" height="200px" src="http://localhost:8888/mypdf/canadaflag.jpg"/ <http://localhost:8888/mypdf/canadaflag.jpg%22/>>


</fo:block>***

<?xml version="1.0" encoding="utf-8"?>

<!-- A small stylesheet to make image links in *.fo files absolute.  This is
currently necessary because FOP doesn't know the 'context' in which it is
operating, and so cannot resolve relative URLs.  This hack will go away once the
Cocoon<->FOP link improves (it's fixed for CVS trunk FOP, but that isn't too
usable yet).  -->

<xsl:stylesheet
  version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:fo="http://www.w3.org/1999/XSL/Format";>

  <!-- Absolute path to context root -->
  <xsl:param name="ctxroot"/>

  <!-- context-relative path of current directory -->
  <xsl:param name="dir"/>

  <xsl:param name="server" />
  <xsl:param name="port" />
  <xsl:param name="servletPath" />
  <xsl:param name="docURI" />

  <xsl:template match="fo:external-graphic/@src">
    <xsl:attribute name="src">
      <xsl:value-of select="$ctxroot"/>
      <xsl:choose>
        <xsl:when test="starts-with(., '/')">
          <xsl:value-of select="."/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$dir"/>
          <xsl:value-of select="."/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:attribute>
  </xsl:template>

  <xsl:template match="fo:basic-link/@external-destination">
    <xsl:attribute name="external-destination">
      <xsl:value-of select="$server"/><xsl:value-of select="substring-before($servletPath, $docURI)"/>
      <xsl:choose>
        <xsl:when test="starts-with(., '/')">
          <xsl:value-of select="substring(., 2)"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="."/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:attribute>
  </xsl:template>

  <!-- Copy across everything else unchanged. -->
  <xsl:template match="node()|@*" priority="-1">
    <xsl:copy>
      <xsl:apply-templates select="@*"/>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to