<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
<document filename="test_052_pagenum.pdf" invariant="1">
<docinit>
	<namedString id="section" discard="1">0</namedString>
</docinit>

<template pageSize="a4" leftMargin="72" showBoundary="1"
    author="A.N. Author"
    subject="My subject"
    title="My title"
    creator="My creator"
	displayDocTitle="1"
	lang="en-US"
    >
	<pageTemplate id="main" pageSize="a4">
		<pageGraphics>
			<namedString id="pageZero" new="1" discard="1">0</namedString>
			<fill color="red"/>
            <setFont name="Helvetica-Bold" size="12" />
    	    <drawRightString x="559" y="18"><evalString><pageNumber/>-<getName id="pageZero"/></evalString> of <getName id="section_pages" indexName="section" default="1"/></drawRightString>
			<fill color="blue"/>
    	    <drawString x="18" y="18"><pageNumber/></drawString>
		</pageGraphics>
		<frame id="1" x1="36" y1="36" width="523" height="770"/>
	</pageTemplate>
</template>

<stylesheet>
	<initialize>
	<alias id="style.normal" value="style.Normal"/>
	</initialize>
	<paraStyle name="h1" fontName="Helvetica-BoldOblique" fontSize="16" leading="12" spaceAfter="16"/>
	<paraStyle name="italic" fontName="Helvetica-Oblique" fontSize="10" leading="12"/>
	<paraStyle name="normal" fontName="Helvetica" fontSize="10" leading="12"/>
</stylesheet>

<story>
	<para style="normal">page 1</para>
	<nextPage/>
	<para style="normal">page 2</para>
	<nextPage/>
	<para style="normal">page 3</para>
	<namedString id="section_pages" indexName="section"><evalString><pageNumber/>-<getName id="pageZero"/></evalString></namedString>
	<namedString id="pageZero"><pageNumber/></namedString>
	<namedString id="section">1</namedString>
	<nextPage/>
	<para style="normal">page 4 red number below should be 1</para>
	<nextPage/>
	<para style="normal">page 5 red number below should be 2</para>
	<nextPage/>
	<para style="normal">page 6 red number below should be 3</para>
	<namedString id="section_pages" indexName="section"><evalString><pageNumber/>-<getName id="pageZero"/></evalString></namedString>
	<namedString id="pageZero"><pageNumber/></namedString>
	<namedString id="section">2</namedString>
	<nextPage/>
	<para style="normal">page 7 red 1</para>
	<nextPage/>
	<para style="normal">page 8 red 2</para>
	<nextPage/>
	<para style="normal">page 9 red 3</para>
	<namedString id="section_pages" indexName="section"><evalString><pageNumber/>-<getName id="pageZero"/></evalString></namedString>
	<namedString id="pageZero">0</namedString>
	<namedString id="section">0</namedString>
</story>
</document>
