How to link a specific attachment to a version? So the user can only see the last attachment?

As there is a risk I am not being clear.

Suppose I have a page for ISO 9001, where I will attach a PDF of ISO 9001:2008.
Then in 2015, ISO 9001:2015 was released. I will attach a PDF of ISO 9001:2015.

The document will go from version 1 to 2. But both attachments will be available. But just like I want only the current version of a page to be readily viewable, I want only the current version of the PDF document to be viewable. In this case, the PDF is the document.

How can that be done?

I don’t know if I got that right, but my answer would be:

To achieve the desired behavior, you can use XWiki’s versioning feature for attachments. XWiki allows you to version the attachments separately from the page, which means you can have different versions of the same attachment and link to the latest version of the attachment in your page.

The trick is: the attachment has to have the same file-name, then you can just overwrite the old one, the version number goes up and you don’t need to change the links on the site.

I understand you. Thanks.

BUT that solution would need careful consideration when having in mind the common users.

I could use many examples, as different versions of external documents will often have different file names. But to stay in the ISO example, ISO 9001 has version 2008, 2015, etc. The file name will reflect that. To have the same filename would require in the servers, to have two different folders to keep both files as backup, so we can have same filenames.

Suppose a user (not well versed in computers) get ISO9001:2008 by email. He saves to his HD and then uploads it to the Wiki. Then he gets the second version, ISO9001:2015. He will just upload it to the ISO 9001 external document. Versioning the document but not the file.If he tries to rename the file, his PC will tell him that there is already a file with the same name. Most probably will rename the file to ISO9001.2008(2).pdf

He will then upload it and again, new attachment.

My acquaintance Chat Gepeetee (:slight_smile:) suggests me I either create a new subpage for each new version and somehow only show the newest version or edit the page and add code to only show the last inserted attachment.

It would be really interesting if we could filter attachments by number (a single one) and by last inserted.

Some suggestions:

get some kind of attachment version list

#foreach ($att in $doc.getAttachmentList())
|$att.Filename |last Version: $att.version 
Version list: ** $att.VersionList **
  #foreach ($version in $att.VersionList)
    $version: $att.getAttachmentRevision($version).Date,  $att.getAttachmentRevision($version).Author, $att.getAttachmentRevision($version).LongSize

create links to attachments, containing “Running” in their file name

#foreach ($att in $doc.getAttachmentList())

Thanks, will try those suggestions.

I don´t think ANY Wiki system does that, but in more standard document management systems, documents are always composed of an attachment that IS the document (a pdf, docx, etc) which is automatically displayed by the system. Thus versioning that attachment always results in versioning the document, as well as only the last version of the attachment is shown (since document = main file attachment).

But if I am not mistaken, you can attach other files too.