melbourne-geek
melbourne-geek

Reputation: 377

XSLT image path is not working

I have a project which is structured as shown in image. This project sends emails out when reseting passwords. I have a folder XSLT with .xslt files in it. I have header, footer and style in Common folder where as ResetPassword.xslt right under XSLT folder.

ResetPassword.xslt:

<?xml version="1.0"?>
  <xsl:include href="Common/Header.xslt"/>

  <xsl:output method="html"/>
  <xsl:template match="/">
    <html>
      <head>
        <xsl:call-template name="Style"/>
      </head>
      <body>
        <table id="resetPasswordBody">
          <tr>
            <td>
              <xsl:call-template name="Header"/> 

As you can see I am calling the Header template from with in ResetPassword.xslt template. In the Header template I have following:

 <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template name="Header">   

          <img src="img\banner.jpg"/>     

    </xsl:template>
</xsl:stylesheet>

The problem is when I run this project inside visual studio (by right click -> show in browser) the image does not appear. I am bit struggling to find out what path I can mention inside the header xslt template so that banner.jpg can appear. I have tried every possible combination.

The only path which works is the full path i.e. C:\XXXXXX\xxxxx

But the problem is when deployed on server the full path will not be a valid one.

I am confused and any help will be great.

Thanks in advance.

Project structure

Upvotes: 1

Views: 927

Answers (1)

Tony Shih
Tony Shih

Reputation: 436

You are calling the file from template it is 2 up to reach the image

../../img/banner.jpg

or img/banner.jpg

Upvotes: 2

Related Questions