I would try something like the following :
Modify your XSL document :
Find
<xsl:template match="DOCUMENT">
Add
<xsl:template match="DOCUMENT">
<xsl:param name="basehref" select="''"/>
In your createXMLDocument() function, add the following line after >
xslDocument.load(xslt);
Add
var basehref=xml.substr(0,xml..lastIndexOf('/'))+'/';
xslDocument.selectSingleNode("//xsl:param[@name='basehref']").setAttribute("select",basehref);
Finally, add this param to your image href
<img><xsl:attribute name="src"><xsl:value-of select="$basehref"
<xsl:value-of select="concat(@NAME,'.png')"/></xsl:attribute></img>
=============
What this does is, it finds the node within your XSL sheet (which is
*also* an XML document ;-), called 'xsl:param' with an attribute
(@name) called 'basehref. This happens on the selectSingleNode line in
your javascript.
Then, it sets the value of the select attribute in the found node
(using setAttribute), to the value you pass in, your javascript
variable 'basehref'.
In your case, you pass in the relative path to the XML file
(xml.substr(0,xml.lastIndexOf('/')) which you then add to the param.
When your XSL comes to contrstuct the path to the IMG, it concats the
param name="basehref" select value (which is now what you passed in
from your javascript) with the @NAME value and .png.
This should then give you a reference to an image in the same
directory as your XML file ;-)
The technique above is called 'parameterising your stylesheet' and is
something Dimitre showed me once, and is way cool.
Have a hack around with the script - its untested but might only need
minor syntax checks to make it work correctly.
Cheers - Neil.
On Wed, 21 Jan 2004 13:28:42 +0100, "Philippe Guglielmetti"
Post by Philippe GuglielmettiPost by Chris BarberWhat are you using to do the transform and what is the context - an
application, an XML IDE such as Xselerator?
I use MSXML called from some JavaScript on a web page.
1) click the "HTML" on the first "test" line : it works
2) click any "HTML" link under the Delta structure : it doesn't work because
the XML and PNG files are located in a different folder.
How is one supposed to do in "pure" XSLT ?
--
Philippe Guglielmetti - www.dynabits.com
========================================================
CaptionKit http://www.captionkit.com : Produce subtitled
internet media, transcripts and searchable video. Supports
Real Player, Quicktime and Windows Media Player.
VideoChat with friends online, get Freshly Toasted every
day at http://www.fresh-toast.net : NetMeeting solutions
for a connected world.