<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- $Id: page-number-citation-last_page-sequence.xml 1683758 2015-06-05 13:57:57Z ssteiner $ -->
<testcase>
  <info>
    <p>
      This test checks fo:page-number-citation-last associated to a page-sequence id.
    </p>
  </info>
  <fo>
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
      <fo:layout-master-set>
        <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
          <fo:region-body margin-bottom="1in" column-count="2" column-gap="10pt" background-color="lightgray"/>
          <fo:region-after extent="1in" display-align="after"/>
        </fo:simple-page-master>
        <fo:simple-page-master master-name="last" page-width="5in" page-height="5in">
          <fo:region-body margin-bottom="3in" column-count="2" column-gap="10pt" background-color="rgb(250,250,240)"/>
          <fo:region-after extent="1in" display-align="after"/>
        </fo:simple-page-master>
        <fo:page-sequence-master master-name="master">
          <fo:repeatable-page-master-alternatives>
            <fo:conditional-page-master-reference master-reference="last" page-position="last"/>
            <fo:conditional-page-master-reference master-reference="normal" page-position="any"/>
          </fo:repeatable-page-master-alternatives>
        </fo:page-sequence-master>
      </fo:layout-master-set>
      <fo:page-sequence master-reference="master" id="replace-last">
        <fo:static-content flow-name="xsl-region-after">
          <fo:block text-align="end">page <fo:page-number/> of <fo:page-number-citation-last ref-id="replace-last"/></fo:block>
        </fo:static-content>
        <fo:flow flow-name="xsl-region-body">
          <fo:block-container id="boxA0" height="1.5in" background-color="yellow" text-align="center" display-align="center" break-after="page">
            <fo:block>box0</fo:block>
          </fo:block-container>
          <fo:block-container id="boxA1" height="1.5in" background-color="yellow" text-align="center" display-align="center">
            <fo:block>box1</fo:block>
          </fo:block-container>
          <fo:block-container id="boxA2" height="1.5in" background-color="orange" text-align="center" display-align="center">
            <fo:block>box2</fo:block>
          </fo:block-container>
          <fo:block-container id="boxA3" height="1.5in" background-color="yellow" text-align="center" display-align="center">
            <fo:block>box3</fo:block>
          </fo:block-container>
          <fo:block-container id="boxA4" height="1.5in" background-color="orange" text-align="center" display-align="center">
            <fo:block>box4</fo:block>
          </fo:block-container>
          <fo:block-container id="boxA5" height="1.5in" background-color="yellow" text-align="center" display-align="center">
            <fo:block>box5</fo:block>
          </fo:block-container>
          <fo:block-container id="boxA6" height="1.5in" background-color="orange" text-align="center" display-align="center">
            <fo:block>box6</fo:block>
          </fo:block-container>
          <fo:block-container id="boxA7" height="1.5in" background-color="yellow" text-align="center" display-align="center">
            <fo:block>box7</fo:block>
          </fo:block-container>
          <fo:block-container id="boxA8" height="1.5in" background-color="orange" text-align="center" display-align="center">
            <fo:block>box8</fo:block>
          </fo:block-container>
          <fo:block-container id="boxA9" height="1.5in" background-color="yellow" text-align="center" display-align="center">
            <fo:block>box9</fo:block>
          </fo:block-container>
          <fo:block-container id="boxA10" height="1.5in" background-color="orange" text-align="center" display-align="center">
            <fo:block>box10</fo:block>
          </fo:block-container>
          <fo:block id="eof"/>
        </fo:flow>
      </fo:page-sequence>
      <fo:page-sequence master-reference="master" id="blank-last">
        <fo:static-content flow-name="xsl-region-after">
          <fo:block text-align="end">page <fo:page-number/> of <fo:page-number-citation-last ref-id="blank-last"/></fo:block>
        </fo:static-content>
        <fo:flow flow-name="xsl-region-body">
          <fo:block-container id="boxB1" height="1.5in" background-color="yellow" text-align="center" display-align="center">
            <fo:block>box1</fo:block>
          </fo:block-container>
          <fo:block-container id="boxB2" height="1.5in" background-color="orange" text-align="center" display-align="center">
            <fo:block>box2</fo:block>
          </fo:block-container>
          <fo:block-container id="boxB3" height="1.5in" background-color="yellow" text-align="center" display-align="center">
            <fo:block>box3</fo:block>
          </fo:block-container>
          <fo:block-container id="boxB4" height="1.5in" background-color="orange" text-align="center" display-align="center">
            <fo:block>box4</fo:block>
          </fo:block-container>
          <fo:block-container id="boxB5" height="1.5in" background-color="yellow" text-align="center" display-align="center">
            <fo:block>box5</fo:block>
          </fo:block-container>
          <fo:block-container id="boxB6" height="1.5in" background-color="orange" text-align="center" display-align="center">
            <fo:block>box6</fo:block>
          </fo:block-container>
          <fo:block-container id="boxB7" height="1.5in" background-color="yellow" text-align="center" display-align="center">
            <fo:block>box7</fo:block>
          </fo:block-container>
          <fo:block-container id="boxB8" height="1.5in" background-color="orange" text-align="center" display-align="center">
            <fo:block>box8</fo:block>
          </fo:block-container>
          <fo:block-container id="boxB9" height="1.5in" background-color="yellow" text-align="center" display-align="center">
            <fo:block>box9</fo:block>
          </fo:block-container>
          <fo:block-container id="boxB10" height="1.5in" background-color="orange" text-align="center" display-align="center">
            <fo:block>box10</fo:block>
          </fo:block-container>
          <fo:block-container id="boxB11" height="1.5in" background-color="orange" text-align="center" display-align="center">
            <fo:block>box11</fo:block>
          </fo:block-container>
        </fo:flow>
      </fo:page-sequence>
    </fo:root>
  </fo>
  <checks>
    <eval expected="2" xpath="count(//pageSequence)"/>
    <eval expected="4" xpath="count(//pageSequence[1]/pageViewport)"/>
    <eval expected="4" xpath="count(//pageSequence[2]/pageViewport)"/>
    
    <eval expected="page 1 of 4" xpath="//pageSequence[1]/pageViewport[@nr=1]/page/regionViewport[2]/regionAfter/block[2]/lineArea"/>
    <eval expected="page 2 of 4" xpath="//pageSequence[1]/pageViewport[@nr=2]/page/regionViewport[2]/regionAfter/block[2]/lineArea"/>
    <eval expected="page 3 of 4" xpath="//pageSequence[1]/pageViewport[@nr=3]/page/regionViewport[2]/regionAfter/block[2]/lineArea"/>
    <eval expected="page 4 of 4" xpath="//pageSequence[1]/pageViewport[@nr=4]/page/regionViewport[2]/regionAfter/block[2]/lineArea"/>
    
    <eval expected="page 5 of 8" xpath="//pageSequence[2]/pageViewport[@nr=5]/page/regionViewport[2]/regionAfter/block[2]/lineArea"/>
    <eval expected="page 6 of 8" xpath="//pageSequence[2]/pageViewport[@nr=6]/page/regionViewport[2]/regionAfter/block[2]/lineArea"/>
    <eval expected="page 7 of 8" xpath="//pageSequence[2]/pageViewport[@nr=7]/page/regionViewport[2]/regionAfter/block[2]/lineArea"/>
    <eval expected="page 8 of 8" xpath="//pageSequence[2]/pageViewport[@nr=8]/page/regionViewport[2]/regionAfter/block[2]/lineArea"/>
  </checks>
</testcase>
