Content-specific conditions in CSL
Hello everybody,
I have a question concerning the use of CSL styles : is it possible to make concrete conditions influence the behaviour of the style? Here are a few examples of what I would like to do, to make my point clearer:
- when a "number-of-volumes" variable is stated for a book, I want it to appear unless the number is 1 (I don't find the information so relevant to read "1 vol." at the end of my reference) => is anything like meaningful?
- when the name of the author matches that of the book author, I would like the latter not to appear => is anything like meaningful?
- finally, this is maybe the most tricky part, but also the most useful in my case, I would like certain items to behave differently with the same style (e.g. references by a certain author, namely the main author discussed in a work). Could I do this by referring to the content of the variable "author" or to that of a certain Tag?
I hope my question is clear enough. Thank you in advance for your help!
Best,
I have a question concerning the use of CSL styles : is it possible to make concrete conditions influence the behaviour of the style? Here are a few examples of what I would like to do, to make my point clearer:
- when a "number-of-volumes" variable is stated for a book, I want it to appear unless the number is 1 (I don't find the information so relevant to read "1 vol." at the end of my reference) => is anything like meaningful?
- when the name of the author matches that of the book author, I would like the latter not to appear => is anything like meaningful?
- finally, this is maybe the most tricky part, but also the most useful in my case, I would like certain items to behave differently with the same style (e.g. references by a certain author, namely the main author discussed in a work). Could I do this by referring to the content of the variable "author" or to that of a certain Tag?
I hope my question is clear enough. Thank you in advance for your help!
Best,
For the third question, Tags are not available to the citation processor. You could code a custom CSL style that uses a specific variable as a flag alerting the processor to use a different format (e.g., if an item contains anything in Extra ['note' in CSL] -- note that this can purely test for the presence or absence of any content, not specific values). Beyond that, there is no way to specify custom formatting like that. If the special formatting is fairly simple (e.g., bold the author's name), it is easy enough to do using Find-and-Replace in your word processor during the final formatting stage of writing.
@bwiernik : the variable to be used as a flag could be an idea indeed; considering what you explained, I suppose this would be the only solution.
@Gracile : the "1 volume" case was an example taken from students making their first steps in Zotero... The issue can be solved by simply filling in the fields accurately.
Rintze's suggestion in that other discussion you mentioned (having a if same-variable-value="author editor" condition) would have been what I hoped to find, but I see the issue is not yet solved for citations... to be followed then!
All the best,