Test if "date-parts" for variable "accessed" are defined
I have a (automatically generated) bibliography with dozens of entries where
- the field "URL" is defined,
- but no fields for "date-parts" under the "accessed" variable
are available.
I use the CSL style file "zeitschrift-fur-kunstgeschichte.csl". The code for printing URLs (line 331 onwards) is
```
choose
if variable="URL" match="any"
group
text variable="URL" prefix=", "/
text term="accessed" prefix=" ("/
date variable="accessed" prefix=" " delimiter="." suffix=")"
date-part name="day"/
date-part name="month" form="numeric"/
date-part name="year"/
/date
/group
/if
/choose
```
As a consequence, in a case as above, a bibliography entry will look like
"Bonito, Virginia Anne, The St Anne Altar in Sant’ Agostino in Rome: A New Discovery, in: The Burlington Magazine 122/933, 1980, S. 805–812, http://www.jstor.org/stable/880160 (letzter Zugriff am.",
because the "URL" is given (while the date-part elements are not).
Now I'd like to leave out the URL altogether in cases where no access date is defined.
I tried to add a second test if the variable "assessed" was defined:
```
choose
if variable="URL" match="any"
if variable="accessed" match="any"
group
...
```
However, this doesn't work: the URL will never be printed, even if an access date is defined.
My question: How would I code the additional test correctly? Any help would be much appreciated.
- the field "URL" is defined,
- but no fields for "date-parts" under the "accessed" variable
are available.
I use the CSL style file "zeitschrift-fur-kunstgeschichte.csl". The code for printing URLs (line 331 onwards) is
```
choose
if variable="URL" match="any"
group
text variable="URL" prefix=", "/
text term="accessed" prefix=" ("/
date variable="accessed" prefix=" " delimiter="." suffix=")"
date-part name="day"/
date-part name="month" form="numeric"/
date-part name="year"/
/date
/group
/if
/choose
```
As a consequence, in a case as above, a bibliography entry will look like
"Bonito, Virginia Anne, The St Anne Altar in Sant’ Agostino in Rome: A New Discovery, in: The Burlington Magazine 122/933, 1980, S. 805–812, http://www.jstor.org/stable/880160 (letzter Zugriff am.",
because the "URL" is given (while the date-part elements are not).
Now I'd like to leave out the URL altogether in cases where no access date is defined.
I tried to add a second test if the variable "assessed" was defined:
```
choose
if variable="URL" match="any"
if variable="accessed" match="any"
group
...
```
However, this doesn't work: the URL will never be printed, even if an access date is defined.
My question: How would I code the additional test correctly? Any help would be much appreciated.
The problem is: In the cases of interest, a URL IS defined (while there is no date of access), but I don't want the URL to be printed.
If I moved 'text variable="URL" prefix=", "/' out of the group, it would still be printed?, which I don't want.
It would be great if there existed an analogous construct to a 'group', which would be printed only if EVERY variable inside of it was filled (unlike the regular 'group', which will print if at least ONE variable is defined).
That said, if you do want to show URL and accessed only if both are present, then change your first if statement in your original post to be:
if variable="URL accessed" match="all"
As to your first question: A simple answer could be that the style as such - if it is the correct representation of the journal's guidelines - doesn't print URLs for, say, journal articles. If it did, I hadn't encountered the bug. =)