0

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>
</object>
</div>
</xsl:template>

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?

Martin

  • 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 '17 at 11:15
0

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

data="https://example.com/subsite/Documents/{@Name}"

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 '15 at 17:36
  • Made a small change, was derping a bit there not including the full URL. – Eric Alexander Feb 17 '15 at 17:38
0

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" />
    </xsl:attribute>
    <p>It appears you don't have a PDF plugin for this browser. Please contact the help desk.</p>
</object>

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

0

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

And pasted it here:

<object>type="application/pdf"

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.