This project is read-only.

Automatically put date into citation?

Sep 24, 2012 at 10:10 AM

Hello Yves,

I would like to automatically put DATE and/or other MS Word fields into the citation.

e.g.: cited: { CREATEDATE \@ "MM/dd/yy" } and so on.

But as far as I know, fields can be only entered by pressing ctrl+F9 and the second difficulty is, that citations are already inserted as field, so it would be inserted as field inside field.

Do you see a way, how to achieve automaticaly inserted date into citations? Is it possible to do this through XSL code somehow.

I would appreciate any advice, that will point me the right direction.

Many thanks




Sep 24, 2012 at 11:31 AM

Where do you want that date? What exactly is the output you try to achieve?

XSLT 1.0 has no support for retrieving the current date. So you won't be able to go that way.

In theory you could nest the date field inside the citation field as a prefix or suffix.

Sep 24, 2012 at 3:22 PM
Edited Sep 24, 2012 at 3:23 PM

I'am working on ISO 690 norm style based on your styles.

I would like to automaticaly add date to the bibliographic entry of every online source, where I need to specify date, when I read and cited that source. In most cases, it is date of creating citation entry. This is a bit tricky, because MS Word fields can only add actual date, or date of creating or last saving/printing of a document, so date of creating bibliographic entry would need some workaround eventually.

Secondly, I would like to add actual year as information about time existence of an internet site, if user leave this information unfilled. e.g. Codeplex have dating "(c) 2006-2012", but some sites, like youtube, have only "(c) 2012" or doesnt have dating at all and in that case, you could automatically add actual year (if the site is still working).

In both cases, I need to add MS Word field inside (in the middle) bibliographic entry. It would be nice, if one can add MS Word fields through the XSL bibliographic style file, but I dont know, how to write a text string, that will MS Word understand as a field. I also tried go around this and get actual date by

<xsl:script language="javascript">

but xsl:script seem to not work in this case.


Sep 25, 2012 at 2:55 PM

No, scripting is disabled inside XSLT. There is some logic to that from a security point of view, although one could argue that if you manage to get an xslt inside the program files directory you already have proven that you have either the rights to do so or that you have stolen access to the computer already.

A workaround would be to use a macro and the Word Object Model (WOM). Using the WOM, it is possible to retrieve the XML of a source. You could check if the year is available and if not, overwrite the entire source (unfortunately it is not possible to set a field which wasn't set before) with an adapted version where you inserted the year. Search for ActiveDocument.Bibliography.Sources for more info.