選擇球

使用 BallotSelection 識別競選中的選票選項,例如將候選人和政黨連結至其得票數。

本文將討論 BallotSelection 及其子實體:

  • BallotSelection
    • CandidateSelection
    • PartySelection
    • BallotMeasureSelection
    • SpecialBallotSelection

選取下列其中一種動態饋給類型,進一步瞭解如何搭配該類型使用 BallotSelection 及其固有元素。


BallotSelection

BallotSelection 是抽象元素,有三種類型,會根據競賽類型使用:

  • CandidateSelection:如果競選活動有一或多位候選人,請使用 BallotSelection 的 type。這會將選票選項連結至 Candidate 元素。
  • PartySelection:如果競選類型是 Party (例如政黨比例競選),請使用這個 BallotSelection 的 type。
  • BallotMeasureSelection:使用這種類型的 BallotSelection,代表 BallotMeasureContest 中的可能選項。
  • SpecialBallotSelection:這類 BallotSelection 用於匯總票數 (例如將多位候選人匯總為「其他」),以及不同類型的無效票 (即空白選票、無效或廢票,以及「以上皆非」票)。

屬性

下表說明 BallotSelection 的屬性:

屬性 是否必要? 類型 說明
objectId 必填 ID 其他元素用來參照這個元素的專屬內部 ID。

元素

下表說明 BallotSelection 的元素:

元素 多重性 類型 說明
SequenceOrder 0 或 1 integer

指定投票選項的預設顯示順序。

如果動態饋給中沒有 SequenceOrder,系統會假設沒有順序。

CandidateSelection

使用 CandidateSelection 識別候選人競選中的選票選項,包括手寫候選人。

CandidateSelection 會繼承 BallotSelection 的屬性和元素。如有需要,可以加入多個 Candidate 元素的參照,例如選票選項是多位候選人的組合。

如果票證參照多位候選人,有時必須保留候選人的順序。在這種情況下,我們預期生成應用程式會根據現有的排序配置,在 CandidateIds 中列出 Candidate 元素的參照。舉例來說,候選人的順序必須與 CandidateContest 類型 Contest 中 OfficeIds 內的 Office 元素參照順序相同。

如果參照多個 Candidate 物件,系統會依下列順序向使用者顯示:

  • 所有將 IsTopTicket 設為 true 的候選項目,都會排在沒有 IsTopTicket 值的候選項目之前。因此,這些候選人會排在所有 IsTopTicket 設為 false 的候選人之前。理想情況下,選取項目會設為沒有 IsTopTicket 值的候選項目,或是設為一對候選項目,其中一個候選項目的 IsTopTicket 設為 true。如果不符合這些條件,會發生以下情況:
    • 所有 IsTopTicket 設為 true 的候選人會以未定義的順序呈現。
    • 所有不含 IsTopTicket 的候選項目都會以未定義的順序顯示。
    • 所有 IsTopTicket 設為 false 的候選人會以未定義的順序呈現。

CandidateSelection 的 XML 語法如下: <BallotSelection xsi:type="CandidateSelection">。

元素

下表說明 CandidateSelection 的元素:

元素 多重性 類型 說明
CandidateIds 1 IDREFS 一或多個 Candidate 元素的專屬 ID。用於將候選人與選票上的候選人選項建立關聯。如果選票上有多位候選人,例如總統和副總統搭檔,這項功能也很有用。
EndorsementPartyIds 0 以上 IDREFS 兩個以上 Party 實體的專屬 ID。這代表政黨在選票上列出同一位候選人。
IncludedInAggregation 0 或 1 boolean 選項的票數是否計入競選活動的 AggregateBallotSelection。如未指定,則會假設為 false。
IsWriteIn 0 或 1 boolean 指出候選人是否為自填候選人。預設值為 false。
PostElectionStatus 0 或 1 CandidatePostElectionStatus 候選人的最終狀態,例如 winner 或 advanced-to-runoff。
PreElectionStatus 0 或 1 CandidatePreElectionStatus 候選人的登記狀態,例如 filed 或 qualified。

範例

XML

    <BallotSelection objectId="cs-10861" xsi:type="CandidateSelection">
      <CandidateIds>can-10861a can-10861b</CandidateIds>
    </BallotSelection>

PartySelection

使用 PartySelection 識別涉及政黨的選票選項,例如選票上的政黨名單選項。

PartySelection 會繼承 BallotSelection 的屬性和元素。PartySelection 的 XML 語法如下:<BallotSelection xsi:type="PartySelection" ... />。

元素

下表說明 PartySelection 的元素:

元素 多重性 類型 說明
IncludedInAggregation 0 或 1 boolean 所選選項的票數是否計入該競賽的 AggregateBallotSelection。如未指定,則會假設為 false。
PartyIds 1 IDREFS 一或多個 Party 元素的專屬 ID。用來將一或多個當事人與當事人選取項目建立關聯。

範例

XML

    <BallotSelection objectId="ps-150" xsi:type="PartySelection">
      <PartyIds>par-100</PartyIds>
    </BallotSelection>

BallotMeasureSelection

使用 BallotMeasureSelection 識別涉及投票措施 (例如公投) 的選票選項。

BallotMeasureSelection 會繼承 BallotSelection 的屬性和元素。BallotMeasureSelection 的 XML 語法如下: <BallotSelection xsi:type="BallotMeasureSelection" ... />。

元素

下表說明 BallotMeasureSelection 的元素:

元素 多重性 類型 說明
ExternalIdentifiers 0 或 1 ExternalIdentifiers 將 ID 與投票議案選項建立關聯。必須提供穩定 ID。
Selection 1 InternationalizedText 提供投票選項,例如 Yes 或 No。

範例

XML

    <BallotSelection objectId="bms-00" xsi:type="BallotMeasureSelection">
      <ExternalIdentifiers>
        <ExternalIdentifier>
          <Type>other</Type>
          <OtherType>stable</OtherType>
          <Value>bms-00-yes</Value>
        </ExternalIdentifier>
      </ExternalIdentifiers>
      <Selection>
        <Text language="en">Yes</Text>
      </Selection>
    </BallotSelection>

XML

    <BallotSelection objectId="bms-00" xsi:type="BallotMeasureSelection">
      <ExternalIdentifiers>
        <ExternalIdentifier>
          <Type>other</Type>
          <OtherType>stable</OtherType>
          <Value>bms-00-yes</Value>
        </ExternalIdentifier>
      </ExternalIdentifiers>
      <Selection>
        <Text language="en">Yes</Text>
      </Selection>
    </BallotSelection>

SpecialBallotSelection

這類 BallotSelection 用於匯總票數 (例如將多位候選人匯總為「其他」),以及不同類型的非投票 (即空白選票、無效或廢票,以及「以上皆非」票)。

SpecialBallotSelection 不應在 Contest 的一般 BallotSelection 子元素中使用,而應在 Contest 上有自己的不同欄位,即 AggregateBallotSelection、BlankBallotSelection、NoneOfTheAboveBallotSelection 和 NullBallotSelection。詳情請參閱Contest元素。

元素

下表說明 SpecialBallotSelection 的元素:

元素 多重性 類型 說明
CountedInTotal 0 或 1 boolean 是否將實體選項的票數計入值得注意的總投票數。如未指定,系統會假設為 true。
ExternalIdentifiers 0 或 1 ExternalIdentifiers 將 ID 與投票議案選項建立關聯。必須提供穩定 ID。
Selection 1 InternationalizedText 為這個選票選項提供名稱,例如「其他」或「以上皆非」。

範例

XML

    <AggregateBallotSelection objectId="sbs-3">
      <Selection>
        <Text language="en">Other Candidates</Text>
      </Selection>
      <ExternalIdentifiers>
        <ExternalIdentifier>
          <Type>other</Type>
          <OtherType>stable</OtherType>
          <Value>sbs-3</Value>
        </ExternalIdentifier>
      </ExternalIdentifiers>
    </AggregateBallotSelection>
    <!-- Counts of ballots left blank -->
    <BlankBallotSelection objectId="sbs-4">
      <Selection>
        <Text language="en">Blank ballots</Text>
      </Selection>
      <!-- These ballots count in the total and can affect majorities -->
      <CountedInTotal>true</CountedInTotal>
      <ExternalIdentifiers>
        <ExternalIdentifier>
          <Type>other</Type>
          <OtherType>stable</OtherType>
          <Value>sbs-4</Value>
        </ExternalIdentifier>
      </ExternalIdentifiers>
    </BlankBallotSelection>
    <!-- Votes for "None of the above" option on the ballot -->
    <NoneOfTheAboveBallotSelection objectId="sbs-5">
      <!--
        The NOTA selection optiona as it appears on the ballot, often
        "None of the above", "None", or "Uncommitted"
      -->
      <Selection>
        <Text language="en">None</Text>
      </Selection>
      <!-- These ballots count in the total and can affect majorities -->
      <CountedInTotal>true</CountedInTotal>
      <ExternalIdentifiers>
        <ExternalIdentifier>
          <Type>other</Type>
          <OtherType>stable</OtherType>
          <Value>sbs-5</Value>
        </ExternalIdentifier>
      </ExternalIdentifiers>
    </NoneOfTheAboveBallotSelection>
    <!--
      Counts of null or spoiled ballots, i.e. ballots that have been marked in
      a way that the vote cannot be counted
    -->
    <NullBallotSelection objectId="sbs-6">
      <!--
        How these ballots are often called in a given country, often
        "null" or "spoiled"
      -->
      <Selection>
        <Text language="en">Spoiled ballots</Text>
      </Selection>
      <!--
        These ballots do count in the total and are treated as the same as
        if this vote did not happen at all
      -->
      <CountedInTotal>false</CountedInTotal>
      <ExternalIdentifiers>
        <ExternalIdentifier>
          <Type>other</Type>
          <OtherType>stable</OtherType>
          <Value>sbs-6</Value>
        </ExternalIdentifier>
      </ExternalIdentifiers>
    </NullBallotSelection>