Set suffix only if macro has succeeding data

Hi,

I’ve had some more time to work on my CSL; I’ve got most of it worked out, so I’m planning on publishing soon.

However I’ve run into an issue… I can’t seem to work out how to conditionally add a suffix, the condition being that there is succeeding data of some sort.

For example:
An in-text cite → FirstName LastName, Year, Pages
In the above example, the year part is a macro as it is used for multiple types which need different things (brackets, etc), and globally the delimiter is set to a ‘space’…

the comma after year is required for type A, but not for type B, for an arbitary reason (Type A needs pages, Type B needs the words ‘personal communication’; just as an example)

Can a macro detect the different types that succeed it in a cite? or even if any succeeding data is present?

Hopefully, I’ve explained this well; I appreciate any assistance, regarding this conundrum.

I guess the <choose> condition is sufficient for that.

    <layout>
      <choose>
        <if type="B">
          <group delimiter=" ">
            <group delimiter=", ">
              <text macro="author-intext"/>
              <text macro="date-intext"/>
            </group>
            <text term="personal-communication"/>
          </group>
        </if>
        <else>
          <group delimiter=", ">
            <text macro="author-intext"/>
            <text macro="date-intext"/>
            <text macro="citation-locator"/>
          </group>
        </else>
      </choose>
    </layout>