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>
---------------------------
-------------------------
<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>
---------------------------
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.
However, I didn't want to mess up with the original Chicago (Author0Date) style, as ours is a slight variation to that.
Thanks.
The second point though still remains - this should work if you switch the order of report and book.
Great real-time help.