xsl-list
[Top] [All Lists]

Accessing Dynamic URL for Image Path

2004-10-15 11:54:58
Accessing Dynamic URL for Image Path

I'm trying to get my images to appear in my XML to HTML transform. I'm having 
trouble identifying and printing the URL to the image. This URL is dynamic, 
depending on which file I am transforming. Basic directory structure is:

/root: contains the stylesheet.xsl and the view.asp page
/article-number/: contains the article XML and image files

so:

stylesheet.xsl
view.asp
/article1/article1.xml
/article1/article1_figure1.jpg

The view page is passed the article number through the querystring:
view.asp?num=article1

It also sets up a variable image_path = /article1/

and that is the relative URL. I'm updating a previous transform which was set 
up this way. It accessed the graphic files by opening them in a new window and 
was able to access the image_path variable through a javascript 
document.writeln() call. However, that was embedded in a javascript function 
which was activated through a link and I'm using inline images now instead of 
opening a new window so the old approach won't work. I may need to try an 
entirely different approach.

My transform looks like this:

<xsl:template name="fig" match="fig">
<img src="/{(_at_)file_name}"/>
</xsl:template>

and I need to insert the URL here:

<img src="/URL/{(_at_)file_name}"/>

This seems to be a simple matter, but I've been unable to find out how to 
insert it. I've read people suggesting to pass the value in as a hard coded 
parameter but since the directory structure is dynamic that won't work. Is 
there a way to access the ASP variable image_path within the XSLT transform? 
Any other suggestion would also be appreciated. Thanks! And unfortunately, the 
DTD we use requires XSLT v 1.0.
        



<Prev in Thread] Current Thread [Next in Thread>