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

1
  • 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 ?? Commented Sep 12, 2017 at 11:15

3 Answers 3

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.

2
  • Almost works. Stays "Initializing" but never loads the PDF. Unfortunately, XSLT List Viewer is all I have access to. Commented Feb 17, 2015 at 17:36
  • Made a small change, was derping a bit there not including the full URL. Commented Feb 17, 2015 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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.