Thanks for your reply,
On Monday, Sep 20, 2004, at 13:29 Europe/London, Jean-Baptiste Quenot wrote:


* Richard Lewis:

How can  I get a transforming  XSLT stylesheet to complete  the URI of
the image from the name given in the <image> element so that it points
to the image correctly?

The best way to deal with resources path is to pass a parameter to the
transformation in the sitemap, and get that parameter in the stylesheet.


sitemap:

<map:transform src='my.xsl'>
  <map:parameter name='resource.path' value='/resources/images'/>
</map:transform>

xsl:

<xsl:param name='resource.path'/>

<img src='{$resource.path}/ok.png'/>

I've actually tried this one but it still doesn't work.

Here's a clipping from my sitemap:

<map:match pattern="*/*">
        .....
        <map:transform src="html/index.xsl">
                <parameter name="section" value="{1}" />
                <parameter name="subsection" value="{2}" />
                <parameter name="resources" value="/cocoon/studio/resources" />
        </map:transform>
</map:match>

and from index.xsl:

<xsl:param name="resources" />
....
<xsl:template match="picture">
        <div class="picture">
                <xsl:if test=".!=''">
                        <img src="{$resources}/{.}" alt="{../name}" />
                </xsl:if>
                <xsl:if test=".=''">
                        <img src="{$resources}/unknown.gif" alt="{../name}" />
                </xsl:if>
        </div>
</xsl:template>

So, by the time the <picture> element is parsed, the URL is in the format:
http://server:8080/cocoon/studio/section/subsection


where 'subsection' is effectively (as I understand it, correct me if I'm wrong) the resultant HTML document from which the path to the image resource must be correct.

Should the (absolute?) path to image I've tried to use be correct? It doesn't work ATM.

Cheers,
Richard


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



Reply via email to