The following help topic has been kindly provided by one of our users. We hope that the information provided will assist you in making any needed changes to your scripts.

Overview

We are in a English speaking congregation and we have the privilege of sponsoring a Lingala Foreign-Language Group. The foreign language group attached to our congregation conducts sections of the midweek meeting each week, though that varies depending on the week of the month:

  • During weeks one, two and four all the parts are automatically presented in the foreign language (except some of the Living as Christian items).
  • During the remaining weeks, only the Congregation Bible Study is conducted.

Note IconWe had to make changes to the Workbook-S-140 template to cater the above issues.

Frequently Asked Questions

How do we test if we are in Foreign-Language Group mode?

There is an attribute that you can check for this. For example:

<xsl:when test="//MeetingWorkBook/Settings/ForeignGroupMode='1')">
  <!-- Do something -->
</xsl:when>

How do we test which week number we are on?

Each week as an attribute indicating this. For example:

<xsl:when test="(@BookmarkId='2' or @BookmarkId='4')">
  <!-- Do something -->
</xsl:when>

Note IconThe (@BookmarkId='2' or @BookmarkId='4') refers to weeks 3 and 5 (zero based indexing).

Issue 1

First, we needed to make sure that during the weeks when we are conducting just the Congregation Bible Study (the third and fifth weeks) that the schedule points to the main auditorium.

Find this section:

<td class="cellName">
  <xsl:choose>
    <xsl:when test="Chairman/@Duplicate=1">
      <span class="textDuplicate">
        <xsl:value-of select="Chairman"/>&#160;
      </span>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="Chairman"/>&#160;
    </xsl:otherwise>
  </xsl:choose>
  <xsl:if test="@NumberClasses &gt;= 2">
    <br/>
    <xsl:choose>
      <xsl:when test="AuxCounsellor1/@Duplicate=1">
        <span class="textDuplicate">
          <xsl:value-of select="AuxCounsellor1"/>&#160;
        </span>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="AuxCounsellor1"/>&#160;
      </xsl:otherwise>
    </xsl:choose>
  </xsl:if>
  <xsl:if test="@NumberClasses = 3">
    <br/>
    <xsl:choose>
      <xsl:when test="AuxCounsellor2/@Duplicate=1">
        <span class="textDuplicate">
          <xsl:value-of select="AuxCounsellor2"/>&#160;
        </span>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="AuxCounsellor2"/>&#160;
      </xsl:otherwise>
    </xsl:choose>
  </xsl:if>

See the first <xsl:choose> entry? We add a new <xsl:when> clause at the top so that it looks like this:

<xsl:choose>
  <xsl:when test="//MeetingWorkBook/Settings/ForeignGroupMode='1' and (@BookmarkId='2' or @BookmarkId='4')">
    <em><xsl:value-of select ="//Labels/MainHall"/></em>
  </xsl:when>
  <xsl:when test="Chairman/@Duplicate=1">
    <span class="textDuplicate">
      <xsl:value-of select="Chairman"/>&#160;
    </span>
  </xsl:when>
  <xsl:otherwise>
    <xsl:value-of select="Chairman"/>&#160;
  </xsl:otherwise>
</xsl:choose>

We have applied a combination of the principles explained in the Frequently Asked Questions section. The new <xsl:when> clause does the following:

  • Confirms that we are in the Foreign-Language Group mode.
  • Confirms that we are on week 3 or 5
  • Displays the Main Hall label instead of the Chairman's name.

Now locate this section in the script:

<!--Display the name of the brother assigned-->
<xsl:template match="Name | PrayerOpen | PrayerEnd">
  <td class="cellName">
    <xsl:choose>
      <xsl:when test="@Duplicate=1">
        <span class="textDuplicate">
          <xsl:value-of select="."/>
        </span>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="."/>
      </xsl:otherwise>
    </xsl:choose>
  </td>
</xsl:template>

We need to introduce two new <xsl:when> clauses at the top like this:

<!--Display the name of the brother assigned-->
<xsl:template match="Name | PrayerOpen | PrayerEnd">
  <td class="cellName">
     <xsl:choose>
        <xsl:when test="//MeetingWorkBook/Settings/ForeignGroupMode='1' and (
                             ancestor::Meeting[@BookmarkId='2'] or 
                             ancestor::Meeting[@BookmarkId='4'] or self::PrayerOpen or self::PrayerEnd)">
          <em><xsl:value-of select ="//Labels/MainHall"/></em>
        </xsl:when>
        <xsl:when test="//MeetingWorkBook/Settings/ForeignGroupMode='1' and .='' and self::Name">
          <em><xsl:value-of select ="//Labels/MainHall"/></em>
        </xsl:when>
        <xsl:when test="@Duplicate=1">
          <span class="textDuplicate">
            <xsl:value-of select="."/>
          </span>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="."/>
        </xsl:otherwise>
     </xsl:choose>
  </td>
</xsl:template>

In the first clause we are:

  1. Confirming that we are in the Foreign-Language Group mode.
  2. Confirming that we are on weeks 3 or 5.
  3. Or testing if the current element is PrayerOpen or PrayerEnd.
    In the second clause we are again confirming that we are in the Foreign-Language Group mode. Except, this time, we limit our test to the Name element. It checks to see if there is an assigned participant for that item (mainly the Living as Christian section). If it finds it is blank it will display the label for the main auditorium.

Note IconThis allows our group to assign a speaker for some of those items but not all and still correctly display on the schedule where the part originates from.


Issue 2

Now all that is required is to make similar changes to a few more of the templates in the file:

  • Locate the Chairman template:

<!--Displays the chairman label-->
<xsl:template name="Chairman">
  <td class="cellName">
    <!--Trims the " :" from the end of the chairman label-->
    <xsl:value-of select="normalize-space(translate(//Labels/Chairman,':',''))"/>
  </td>
</xsl:template>

And change it like this:

<!--Displays the chairman label-->
<xsl:template name="Chairman">
  <td class="cellName">
    <!--Trims the " :" from the end of the chairman label-->
    <xsl:choose>
      <xsl:when test="//MeetingWorkBook/Settings/ForeignGroupMode='1' and (
                           ancestor::Meeting[@BookmarkId='2'] or 
                           ancestor::Meeting[@BookmarkId='4'])">
        <em><xsl:value-of select ="//Labels/MainHall"/></em>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="normalize-space(translate(//Labels/Chairman,':',''))"/>
      </xsl:otherwise>
    </xsl:choose>
  </td>
</xsl:template>

  • Locate the BibleReadingItem template and identify the Readers loop:

<!--Displays all of the bible reading students for each class-->
<xsl:template match="BibleReadingItem">
  <tr>
    <xsl:apply-templates select="Time" mode="End"/>
    <td class="cellTheme">
      <span class="bulletTFGW">&#8226;</span>
      <span class="textTheme">
        <xsl:value-of select="Type"/>
      </span>
      <xsl:apply-templates select="Time" mode="Duration"/>
      <xsl:apply-templates select="Material"/>
    </td>
    <td class="cellPosition">
      <xsl:value-of select="//Labels/Student"/>
    </td>
    <xsl:for-each select="Readers/Reader">
      <td class="cellName">
        <xsl:choose>
          <xsl:when test="@Duplicate=1">
            <span class="textDuplicate">
              <xsl:value-of select="."/>
            </span>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="."/>
          </xsl:otherwise>
        </xsl:choose>
      </td>
    </xsl:for-each>
  </tr>
</xsl:template>

We introduce a new <xsl:when> clause here so it looks like this:

<!--Displays all of the bible reading students for each class-->
<xsl:template match="BibleReadingItem">
  <tr>
    <xsl:apply-templates select="Time" mode="End"/>
    <td class="cellTheme">
      <span class="bulletTFGW">&#8226;</span>
      <span class="textTheme">
        <xsl:value-of select="Type"/>
      </span>
      <xsl:apply-templates select="Time" mode="Duration"/>
      <xsl:apply-templates select="Material"/>
    </td>
    <td class="cellPosition">
      <xsl:value-of select="//Labels/Student"/>
    </td>
    <xsl:for-each select="Readers/Reader">
      <td class="cellName">
        <xsl:choose>
          <xsl:when test="//MeetingWorkBook/Settings/ForeignGroupMode='1' and (
                               ancestor::Meeting[@BookmarkId='2'] or 
                               ancestor::Meeting[@BookmarkId='4'])">
            <em><xsl:value-of select ="//Labels/MainHall"/></em>
          </xsl:when>
          <xsl:when test="@Duplicate=1">
            <span class="textDuplicate">
              <xsl:value-of select="."/>
            </span>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="."/>
          </xsl:otherwise>
        </xsl:choose>          
      </td>
    </xsl:for-each>
  </tr>
</xsl:template>

  • Locate the Students template:

<!--Displays the student and assistant for the current student item-->
<xsl:template match="Students">
  <td class="cellName">
    <xsl:choose>
      <xsl:when test="../@IsSampleVideo=1">
        <xsl:choose>
          <xsl:when test="@ChairmanHandleSampleVideo=0">
            <xsl:value-of select="//Labels/Counsellor"/>
          </xsl:when>
          <xsl:otherwise>
            <!--Trims the " :" from the end of the chairman label-->
            <xsl:value-of select="normalize-space(translate(//Labels/Chairman,':',''))"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:when>
      <xsl:otherwise>
        <xsl:choose>
          <xsl:when test="Student/@Duplicate=1">
            <span class="textDuplicate">
              <xsl:value-of select="Student"/>
            </span>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="Student"/>
          </xsl:otherwise>
        </xsl:choose>
        <xsl:if test="../@IsTalk=0">
          <br/>
          <xsl:choose>
            <xsl:when test="Assistant/@Duplicate=1">
              <span class="textDuplicate">
                <xsl:value-of select="Assistant"/>
              </span>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="Assistant"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:if>
      </xsl:otherwise>
    </xsl:choose>
  </td>
</xsl:template>

We change it like this:

<!--Displays the student and assistant for the current student item-->
<xsl:template match="Students">
  <td class="cellName">
    <xsl:choose>
      <xsl:when test="../@IsSampleVideo=1">
        <xsl:choose>
          <xsl:when test="//MeetingWorkBook/Settings/ForeignGroupMode='1' and (
                               ancestor::Meeting[@BookmarkId='2'] or 
                               ancestor::Meeting[@BookmarkId='4'])">
            <em><xsl:value-of select ="//Labels/MainHall"/></em>
          </xsl:when>
          <xsl:when test="@ChairmanHandleSampleVideo=0">
            <xsl:value-of select="//Labels/Counsellor"/>
          </xsl:when>
          <xsl:otherwise>
            <!--Trims the " :" from the end of the chairman label-->
            <xsl:value-of select="normalize-space(translate(//Labels/Chairman,':',''))"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:when>
      <xsl:when test="//MeetingWorkBook/Settings/ForeignGroupMode='1' and (
                           ancestor::Meeting[@BookmarkId='2'] or 
                           ancestor::Meeting[@BookmarkId='4'])">
        <em><xsl:value-of select ="//Labels/MainHall"/></em>
      </xsl:when>
      <xsl:otherwise>
        <xsl:choose>
          <xsl:when test="Student/@Duplicate=1">
            <span class="textDuplicate">
              <xsl:value-of select="Student"/>
            </span>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="Student"/>
          </xsl:otherwise>
        </xsl:choose>
        <xsl:if test="../@IsTalk=0">
          <br/>
          <xsl:choose>
            <xsl:when test="Assistant/@Duplicate=1">
              <span class="textDuplicate">
                <xsl:value-of select="Assistant"/>
              </span>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="Assistant"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:if>
      </xsl:otherwise>
    </xsl:choose>
  </td>
</xsl:template>

This last change ensures that we correctly insert the right term for the auxiliary classroom in the foreign language.


Download

We hope you have found this article helpful and that it has given you an insight into the power of using XML / XSL scripting. You should be able to prepare your schedules in such a manner that fits the needs of your congregation and Foreign-Language Group.

Note IconThis customized script is available to download on the website. Feel free to give it a try and see if it meets the needs of your group.