I don't think it's going to work for EPUB.
You can set up two layouts, one for PDF and one for EPUB:
You would have two master pages, two sets of paragraph styles, etc.
The problem comes on export. If you're exporting PDF, you have the option of choosing a page range. You can choose, in this example, to export "PDF:1-11" to export those pages.
However, the EPUB export dialog, has no option for exporting a range of pages. It's all or nothing. It would export everything on both sets of pages as one stream.
Thank you for the very clear explanation, Steve. Eugene, thank you for the helpful link.
Steve, the page-range issue would be a problem in my case, as the shorter epub text (since all formatting is done using styles) would include pdf pages. Thank you for bringing this to my attention.
Reading your post again I see that the problem is bigger than just extra pages; it would actually export everything. So it's just not going to work if my alternate layout is epub and my plan is to export as such. oh well Thanks again!
If the primary layout is epub then maybe there is a work-around.
As stated above, exporting the PDF is no problem as you can select which pages (or layout) to export.
For the epub you cannot.
But once your file is ready for epub export simply delete the alternate layout (the PDF layout), then export epub. With the epub file exported DO NOT SAVE your source file.
Next time you need to update the master you would still have both layouts available.
I think that would work for you.
Supposing a twinned alternate layout: one for ePub; one for PDF. You CAN control what gets Exported to ePub IF you use the Articles panel. Whatever is dragged into and ordered into the Articles panel would be what ends up in the ePub export. To make sure, when you get to the Export to EPUB dialog box, look for Content Order and set it to Same as Articles Panel.