How to output "No Author" for works with no author

edited October 3, 2018
I am right now putting together a citation style where works with an unknown author are introduced by the term "Anon." (or O. A. as the style is in German). I am using a this macro, but this does not lead to the required results.












  • I have now posted the style on hastebin: https://hastebin.com/eyobezamuq.xml
    The relevant macro is called "primary-contributor" (beginning on line 14).
  • In the locale section at the top of the style, add:
    <term name="anonymous">No Author</term>

    After the similar term line for editor that is already there.

    You can also remove the choose/if logic at the start of the primary-contributors macro and just add <text term="anonymous"/> after editor in the substitute section.
  • Ok, I'll try that. But why is my choose/if not applied?
    It works if I change match ="none" to match="any", which is, of course, something different?
  • It looks correct to me (other then you would want to put the other parts of that macro in and else node generally), so I would have to see the item you use. Nevertheless, the best place for the anonymous line would be as the last option in substitute.
  • edited October 3, 2018
    Tried it: https://hastebin.com/menehubeha.xml
    Still no change. I've also tried adding another substitute section, but this does not give me "o.A." either.
    Oh, I am using the example citations in the visual editor. (The Webpage CSL by example has no author and editor, so I think it should give me o.A., right?)
  • I don't know if this is the problem, but you're getting a bunch of validation errors, mostly related to macro names (don't use + or /). Fix these before troubleshooting further:
    https://validator.citationstyles.org/?url=https://hastebin.com/raw/eyobezamuq&amp;version=1.0.1
  • Ok, I have now fixed all validation errors: https://hastebin.com/ejekawevah.xml
    Still no "no author"-term.
  • Ah OK, so the reasoning for this is a bit involved and has to do with how group works and what elements of a citation get implicitly treated as a group by the citation processor, but the short version is that you need to create a macro for anonymous, such as
    <macro name="anon">
    <text term="anonymous"/>
    </macro>


    And then call that in substitute.
  • @adamsmith For my understanding, could you elaborate on the implicit logic that is happening here?
  • Great! It works. Thank you.
    I'd be also interested in why calling a text term directly doesn't work.
    By the way: How do you post code in this forum?

  • post code by wrapping it in HTML <code> </code> tags
  • edited October 3, 2018
    Wrap the code in <code> </code> Tags
  • The elements of <names> get treated as a group. Groups have an implicit conditional that, if the group contains any variable, any terms or values in that group are only rendered if at least one variable is present (see http://docs.citationstyles.org/en/stable/specification.html#group ). That's obviously not the case for names if no author or editor is present, so the term doesn't get printed. You can prevent the implicit conditional in groups by wrapping terms in macros, which is the solution above.
  • Thanks that makes sense.
Sign In or Register to comment.