Marc Kupietz | 9117589 | 2023-01-21 18:36:12 +0100 | [diff] [blame] | 1 | namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0" |
| 2 | namespace cs = "http://purl.org/net/xbiblio/csl" |
| 3 | |
| 4 | |
| 5 | ## cs:choose - Conditional Statements" |
| 6 | div { |
| 7 | rendering-element.choose = |
| 8 | |
| 9 | ## Use to conditionally render rendering elements. |
| 10 | element cs:choose { choose.if, choose.else-if*, choose.else? } |
| 11 | choose.if = element cs:if { condition+, match, rendering-element* } |
| 12 | choose.else-if = |
| 13 | element cs:else-if { condition+, match, rendering-element* } |
| 14 | choose.else = element cs:else { rendering-element+ } |
| 15 | condition = |
| 16 | |
| 17 | ## If used, the element content is only rendered if it disambiguates two |
| 18 | ## otherwise identical citations. This attempt at disambiguation is only |
| 19 | ## made after all other disambiguation methods have failed. |
| 20 | [ a:defaultValue = "true" ] attribute disambiguate { "true" } |
| 21 | | |
| 22 | ## Tests whether the given variables contain numeric text. |
| 23 | attribute is-numeric { |
| 24 | list { variables+ } |
| 25 | } |
| 26 | | |
| 27 | ## Tests whether the given date variables contain approximate dates. |
| 28 | attribute is-uncertain-date { |
| 29 | list { variables.dates+ } |
| 30 | } |
| 31 | | |
| 32 | ## Tests whether the locator matches the given locator types. |
| 33 | attribute locator { |
| 34 | list { terms.locator+ } |
| 35 | } |
| 36 | | |
| 37 | ## Tests whether the cite position matches the given positions. |
| 38 | attribute position { |
| 39 | list { |
| 40 | ("first" |
| 41 | | "subsequent" |
| 42 | | "ibid" |
| 43 | | "ibid-with-locator" |
| 44 | | "near-note")+ |
| 45 | } |
| 46 | } |
| 47 | | |
| 48 | ## Tests whether the item matches the given types. |
| 49 | attribute type { |
| 50 | list { item-types+ } |
| 51 | } |
| 52 | | |
| 53 | ## Tests whether the default ("long") forms of the given variables |
| 54 | ## contain non-empty values. |
| 55 | attribute variable { |
| 56 | list { variables+ } |
| 57 | } |
| 58 | match = |
| 59 | |
| 60 | ## Set the testing logic. |
| 61 | [ a:defaultValue = "all" ] |
| 62 | attribute match { |
| 63 | |
| 64 | ## Element only tests "true" when all conditions test "true" for all |
| 65 | ## given test values. |
| 66 | "all" |
| 67 | | |
| 68 | ## Element tests "true" when any condition tests "true" for any given |
| 69 | ## test value. |
| 70 | "any" |
| 71 | | |
| 72 | ## Element only tests "true" when none of the conditions test "true" |
| 73 | ## for any given test value. |
| 74 | "none" |
| 75 | }? |
| 76 | } |