0

I created an xsl file to change the appearence of the Picture Library. As I had troubles to get the PictureURL I took the value of the "FileLeafRef" to get the filename of the picture. Than I use the site url and add the value of "FileLeafRef". It works fine for the current site but I would like to use the same style on different subsites with the same Picture Library. How can I insert the current siteURL into img src=" "... I already tried the value of _spPageContextInfo.webAbsoluteUrl but I don't get any value. This is the code I'm using:


    <xsl:variable name="LinkToBook">
        <xsl:value-of select="@LinkToBook"/>    
    </xsl:variable>

<div class="bookimage">
<a href="{$LinkToBook}" target="_blank">
<img src="/sites/sitecollection/subsite/subsubsite/FeaturedBooks/{$FileLeafRef}" alt="{$FileLeafRef}" disable-output-escaping="yes"/>
</a>
</div>
<br/>
<br/>

1 Answer 1

0

Instead using FileLeafRef use FileRef will work examlpe

<img src="{@FileRef}" alt="{$FileLeafRef}" disable-output-escaping="yes"/>
3
  • I already tried this approach but I get always the following message: Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator. Correlation ID:266e1b9e-f2c8-30d8-c784-120f58a518b9
    – user70367
    Commented Sep 21, 2017 at 13:52
  • No I entered: <xsl:param name="WebUrl"/> below the xsl:styelsheet and the error message doesn't show up but I get only an empty string
    – user70367
    Commented Sep 21, 2017 at 14:11
  • updated the answer
    – Sunil Sahu
    Commented Sep 21, 2017 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.