Generic fallback for report type not working

I have taken the Chicago Manual of Style (Author-Date format) and modified it a little bit. One of the things we need is to non-italicize and put quotes around a report title. I cannot get my code to work. I type the code below. I would appreciate any ffedback on that.
-------------------------
<macro name="title">
<choose>
<if variable="title" match="none">
<choose>
<if type="personal_communication" match="none">
<text variable="genre" text-case="capitalize-first"/>
</if>
</choose>
</if>
<else-if type="book">
<text variable="title" font-style="italic"/>
</else-if>
<else-if type="report">
<text variable="title" quotes="true"/>
</else-if>
<else-if type="chapter">
<text variable="title" quotes="true" suffix="."/>
</else-if>
<else-if type="article-journal">
<text variable="title" quotes="true" />
</else-if>

<else>
<text variable="title"/>
</else>
</choose>
</macro>
---------------------------
  • edited December 4, 2009
    two things:
    First, the if loops are a bit of a mess:
    So you're testing if there is no title variable - and then you're using "else-if"s that have to do with item type? And all of them are concerned with the title variable that you have just tested isn't actually there? Something is wrong here. What's the first "if" line supposed to achieve?

    Second, since "book" is the fallback for report, you need to test for report before testing for book if you want it to work correctly.
  • I totally agree that the loops are messy.
    However, I didn't want to mess up with the original Chicago (Author0Date) style, as ours is a slight variation to that.
    Thanks.
  • oh ok - you're right, that's in the original style - ugly.
    The second point though still remains - this should work if you switch the order of report and book.
  • It did work like a charm. Thanks many. The tip on how generic fallback works is also very useful for me. Sorry, I didn't see it first time.
    Great real-time help.
  • I've modified the wiki in order to make the explanation of generic fallbacks more clear.
Sign In or Register to comment.