Code in ignored

I have a macro like this to distinguish between types in one of my custom styles...

<macro name="issued">
<choose>
<if type="book chapter" match="any">
...
</if>
<else-if type="article-journal article-magazine" match="any">
...
</else-if>
<else-if type="article-newspaper">
...
</else-if>
<else-if type="manuscript">
...
</else-if>
<else>
...
</else>
</choose>
</macro>

Funny thing is, code in <else></else> (the fallback for all other types) gets ignored. Any ideas?
  • we'd need to see the full code - there's nothing wrong with the structure as you have it above.
  • Okay, I've narrowed it down to the minimum example below. There is something about the syntax of CSL (especially the group tag) that I don't understand because the line

    <text variable="publisher-place"/>

    (or a similar one) breaks the following <choose></choose> conditional.

    <?xml version="1.0" encoding="utf-8"?>
    <style xmlns="http://purl.org/net/xbiblio/csl" version="1.0" class="note">
    <info>
    <title>1</title>
    <id>http://www.zotero.org/styles/1</id>;
    <updated>2012-02-07T01:46:04+00:00</updated>
    </info>
    <citation>
    <layout>
    <names variable="author"/>
    <group>
    <text variable="publisher-place"/> <!-- comment this line to make it work -->
    <choose>
    <if variable="issued">
    <date variable="issued" form="numeric"/>
    </if>
    <else>
    <text term="no date"/>
    </else>
    </choose>
    </group>
    </layout>
    </citation>
    </style>
  • you're hitting this:
    cs:group implicitly acts as a conditional: cs:group and its child elements are suppressed if a) at least one rendering element in cs:group calls a variable (either directly or via a macro), and b) all variables that are called are empty. This accommodates descriptive cs:text elements
    http://citationstyles.org/downloads/specification.html#id56
  • Thanks -- and sorry for ignoring the straightforward explanation in the specification.
  • no worries at all - while I think this makes a lot of sense from an implementation point of view, I think "straightforward" is stretching it ;-), especially when it's "hidden" inside a cs:choose element such as in your case.
Sign In or Register to comment.