Nested if statements possible?

Hi,

I created a modified style to use with Zotero and Zotpress. The purpose is to allow a place a list of Zotero items on a web site. Technically, it’s a bibliography, but the purpose is to show users a list of relevant documents and sites to the topic at hand. At such, I’ve stripped down what is displayed and added some notations.

My question is whether it is possible to nest statements within a structure (and if not, why not?).
This works:
{layout}
{choose}
{if variable=“genre”}
{text value=“Organization web site” suffix=“:”/}
{/if}
{else-if type=“webpage”}
{text value=“Web page” suffix=“:”/}
{/else-if}
{else-if type=“book”}
{text value=“Book” suffix=“:”/}
{/else-if}…

What I would like to do is:

{if type=“webpage”}
{if variable=“genre”}
{text value=“Organization web site” suffix=“:”/}
{/if}
{else type=“webpage”}
{text value=“Web page” suffix=“:”/}
{/else}
{/if}
{else-if type=“book”}
{text value=“Book” suffix=“:”/}
{/else-if}…

(Changed the angles to curly braces…I am new to this forum and my attempts to use formatted text and blockquotes didn’t show up in the published post…at least I couldn’t see them.)

Is the nesting not permitted? Or have I just goofed up the structure?

Thanks for any help you can provide.

You’d have to wrap the second level in another <choose> element.

(You can input preformatted text by adding “fences” (```) on either side, or selecting the text and clicking the </> button.)

But you should also, in this case, be able to make the first if have two conditions:

<layout>
  <choose>
    <if type="webpage" variable="genre" match="all">
      <!-- ... -->
    </if>
    <else-if type="webpage">
      <!-- ... -->
    </else-if>
    <else-if type="book">
      <!-- ... -->
    </else-if>
    <!-- ... -->
  </choose>
</layout>

Worked like a champ. Thank you!

Thanks for the pointer about adding fences. I’ll have to try that again. I used the </> button and pasted my text between the () marks, but the text didn't show up when I viewed the posted item. Do I need to use a set of () marks on each line, perhaps?

Yes, that should work. I hadn’t dug far enough to find out how to match two or more conditions. That’s more straightforward for this case, as well.

Thanks!

Looking at the raw content of your first edit, I don’t really know what happened (and the button doesn’t do what I thought it did). This is the way to go (and you can replace “xml” by other things for syntax highlighting):

```xml
<paste here>
```