psm.getSinglePageMasterReferenceOrRepeatablePageMasterReferenceOrRepeatablePageMasterAlternatives().add(rpma);
// has first header or footer?
if (hf.getFirstHeader()!=null || hf.getFirstFooter()!=null) {
ConditionalPageMasterReference cpmr1 = getFactory().createConditionalPageMasterReference();
cpmr1.setMasterReference(sectionName+"-firstpage");
cpmr1.setPagePosition(PagePositionType.FIRST);
rpma.getConditionalPageMasterReference().add(cpmr1);
}
if (hf.getEvenHeader()!=null || hf.getEvenFooter()!=null) {
ConditionalPageMasterReference cpmr2 = getFactory().createConditionalPageMasterReference();
cpmr2.setMasterReference(sectionName+"-evenpage");
//cpmr2.setPagePosition(PagePositionType.FIRST);
cpmr2.setOddOrEven(OddOrEvenType.EVEN);
rpma.getConditionalPageMasterReference().add(cpmr2);
// the xslt outputs a "-default" page as the odd-page
ConditionalPageMasterReference cpmr3 = getFactory().createConditionalPageMasterReference();
cpmr3.setMasterReference(sectionName+"-default");
//cpmr3.setPagePosition(PagePositionType.FIRST);
cpmr3.setOddOrEven(OddOrEvenType.ODD);
rpma.getConditionalPageMasterReference().add(cpmr3);
noHeadersFootersAfterFirstPage = false;
} else if (hf.getDefaultHeader()!=null || hf.getDefaultFooter()!=null) {
ConditionalPageMasterReference cpmr4 = getFactory().createConditionalPageMasterReference();
cpmr4.setMasterReference(sectionName+"-default");
//cpmr4.setPagePosition(PagePositionType.FIRST);
rpma.getConditionalPageMasterReference().add(cpmr4);
noHeadersFootersAfterFirstPage = false;
}
if (noHeadersFootersAfterFirstPage) {
ConditionalPageMasterReference cpmr5 = getFactory().createConditionalPageMasterReference();
cpmr5.setMasterReference(sectionName+"-simple");
//cpmr5.setPagePosition(PagePositionType.FIRST);
rpma.getConditionalPageMasterReference().add(cpmr5);
}
return psm;