Citation Style Language

Rendering a variable twice (in cs:substitute)

What’s going on in the substitute_SuppressOrdinaryVariable test case? There are two <names variable="editor" /> back to back (effectively), but with citeproc-js and in the expected output only one is rendered.

Is this part of the spec? The post is from 2009 so I thought things may have changed since then.

Test case:

>>===== MODE =====>>
bibliography
<<===== MODE =====<<



>>===== RESULT =====>>
<div class="csl-bib-body">
  <div class="csl-entry">“The Title.” The Publisher.</div>
  <div class="csl-entry">John-boy Doe ed. <i>The Title</i>. The Publisher.</div>
  <div class="csl-entry">Jane-girl Doe editor. <i>The Title</i>. The Organization.</div>
</div>
<<===== RESULT =====<<


>>===== CSL =====>>
<style 
      xmlns="http://purl.org/net/xbiblio/csl"
      class="note"
      version="1.0">
  <info>
    <id />
    <title />
    <updated>2009-08-10T04:49:00+09:00</updated>
  </info>
  <macro name="editor">
    <choose>
      <if type="book">
        <text macro="editor-short-label"/>
      </if>
      <else>
        <text macro="editor-long-label"/>
      </else>
    </choose>
    <names variable="editor">
      <name/>
      <label prefix=" "/>
    </names>
  </macro>
  <macro name="editor-long-label">
    <names variable="editor">
      <name/>
      <label prefix=" "/>
    </names>
  </macro>
  <macro name="editor-short-label">
    <names variable="editor">
      <name/>
      <label prefix=" " form="short"/>
    </names>
  </macro>
  <citation>
    <layout delimiter="; ">
      <text variable="title"/>
    </layout>
  </citation>
  <bibliography>
    <layout suffix=".">
      <group delimiter=". ">
        <names variable="translator">
          <label form="verb" suffix=" "/>
          <name/>
          <substitute>
            <text macro="editor"/>
            <text variable="title" quotes="true"/>
          </substitute>
        </names>
        <text variable="title" font-style="italic"/>
        <text variable="publisher"/>
      </group>
    </layout>
  </bibliography>
</style>
<<===== CSL =====<<


>>===== INPUT =====>>
[
    {
        "id": "ITEM-1", 
        "publisher": "The Publisher", 
        "title": "The Title", 
        "type": "book"
    }, 
    {
        "editor": [
            {
                "family": "Doe", 
                "given": "John-boy"
            }
        ], 
        "id": "ITEM-2", 
        "publisher": "The Publisher", 
        "title": "The Title", 
        "type": "book"
    }, 
    {
        "editor": [
            {
                "family": "Doe", 
                "given": "Jane-girl"
            }
        ], 
        "id": "ITEM-3", 
        "publisher": "The Organization", 
        "title": "The Title", 
        "type": "report"
    }
]
<<===== INPUT =====<<

Logically what is happening there is that, once the processor fails on a cs:names variable (in this case translator) and descends into cs:substitute, suppression of any variable rendered within that context (at any level of nesting) kicks in immediately, and stays in effect for the remainder of the cite. To render editor twice in succession, the first, at least, would need to be called a top level (i.e. outside of the cs:substitute context).

1 Like

Okay, that’s what I suspected. Thank you.