>>===== MODE =====>> citation <<===== MODE =====<< This test supports a proposal for extending CSL's conditional attributes. The proposal introduces two new nodes and associated schema adjustments: * A cs:conditions element, as an optional first child of cs:if or cs:else-if, with a sole match attribute. When cs:conditions is used, its parent (cs:if or cs:else-if) must have no attributes. Only cs:condition elements are permitted as children of cs:condition, and there must be at least one such child. * A cs:condition element, with the same attributes as cs:if or cs:else-if. The proposal also introduces a new value "nand" for the match attribute. Under the proposal, conditional evaluation would take place as follows: (1) cs:if and cs:else-if elements with attributes process exactly as under the current schema and specification. (2) cs:if and cs:else-if element with no attributes apply the conditions provided by the immediate cs:conditions child and its cs:condition children. The cs:condition children are evaluated first, according to the same logic as cs:if and cs:else-if. The results are then combined according to the match element on cs:conditions, returning a single boolean result for the parent cs:fi or cs:else-if element. This change makes it possible to reduce the bulk of CSL code. As one example, the construct below is found in several styles in the CSL repository: What the code does is to print the "accessed" date if the item is a webpage and has no "issued" date, and otherwise to print the "issued" date, regardless of item type. A nested cs:choose statement is needed, because negative and positive conditions cannot be declared together on the same cs:if or cs:else-if element. With the proposed syntax, the code sample above can be rewritten as a single cs:choose statement: >>===== RESULT =====>> Item One is not an ARTICLE-JOURNAL, and has an EDITION Item Two is a BOOK, but has no EDITION Item Three is a CHAPTER, and has an AUTHOR Item Four is an ARTICLE-JOURNAL with both VOLUME and ISSUE, but one of them is non-numeric Item Five is an ARTICLE-JOURNAL with both VOLUME and ISSUE, and both of them are numeric <<===== RESULT =====<< >>===== CSL =====>> <<===== CSL =====<< >>===== INPUT =====>> [ { "edition": "5", "id": "ITEM-1", "title": "Item One", "type": "book" }, { "id": "ITEM-2", "title": "Item Two", "type": "book" }, { "author": [ { "family": "Snoapes", "given": "John" } ], "id": "ITEM-3", "title": "Item Three", "type": "chapter" }, { "id": "ITEM-4", "issue": "1", "title": "Item Four", "type": "article-journal", "volume": "Supplement" }, { "id": "ITEM-5", "issue": "4", "title": "Item Five", "type": "article-journal", "volume": "2" } ] <<===== INPUT =====<<