I am attempting using the XSLT List View webpart to display the most recent PDF file uploaded to a Document library.

The idea is that a specific user uploads a PDF file for a monthly newsletter to a Document Library. I have a View set up to display one item (the most recent item).

I can get it to work by specifying the entire path to the file as such:

<xsl:template match="Item">
<div class="item">
<object data="https://example.com/subsite/Documents/file.pdf" type="application/pdf" width="700px" height="550px">
<p>It appears you don't have a PDF plugin for this browser.</p>

However I am hoping to enter the URL as something like this:

"https://example.com/subsite/Documents/<xsl:value-of select='Name'/>"

I am unable to enter the XSL tag within the html Object tag.

Any suggestions?


  • I am sending a E-mail using xslt file. If i want to attach a pdf file with that E-mail,then how can i attach ??
    – user70261
    Sep 12, 2017 at 11:15

3 Answers 3


Assuming everything else is correct in your web part, it should be a matter of doing this:


Personally, I use a data view web part instead of XSLT list views because I get total control of what I'm doing and the rendered output. If doing the above doesn't work, it could be converted to a dataview web part and then it should work with the data="https://example.com/subsite/Documents/{@Name}" piece.

  • Almost works. Stays "Initializing" but never loads the PDF. Unfortunately, XSLT List Viewer is all I have access to.
    – Martin
    Feb 17, 2015 at 17:36
  • Made a small change, was derping a bit there not including the full URL. Feb 17, 2015 at 17:38

Took some days off from work and returned with a fresh mind to this task. I was ale to achieve the desired results by adding an additional column to the document library for users to enter the file name. Then used XSL attributes as follows:

<object type="application/pdf" width="700px" height="550px">
    <xsl:attribute name="data">
            <xsl:text>/Site/Documents/</xsl:text><xsl:value-of select="File" />
    <p>It appears you don't have a PDF plugin for this browser. Please contact the help desk.</p>

Extra step for the users but they will have to deal with that inconvenience for now.


1- Created library app 2- Uploaded PDF 3- Opened PDF within browser 4- Copied link

And pasted it here:


It worked

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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