[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Splitting XHTML by elements that have page-breaks

Subject: Re: Splitting XHTML by elements that have page-breaks
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 16 Sep 2009 11:01:46 -0400
Re:  Splitting XHTML by elements that have page-breaks

If your sibling recursion is very complex, it can be managed more easily by separating the process into two phases. Phase one marks the places where the splitting has to occur. (For example, you could use attribute flags on the elements starting the new chunk.) Phase two performs the sibling recursion, splitting at those places (looking for the attribute flags, not something else).

This way all the logic controlling where the splitting should happen is separate from the sibling recursion, which tends to make it much easier to see, extend and maintain.

In XSLT 2.0, where we can use for-each-group instead of sibling recursion, the same encapsulation can be achieved using a function.


At 07:24 PM 9/15/2009, you wrote:
Hey list,

I asked recently how to split a big XHTML file into several chunks
(under 300 KB) for use in ePub. I have that problem semi-solved -- I
decided to go the easier route and split the file into chapters, and
the chunks turned out to be well less than 300 KB, so I'll stick to
that so far.

I used sibling recursion on html:h1 elements, and that worked fine.
But now I need not only headings to be used for splitting, but many
more elements, e.g. html:p[@class = 'Quote'] -- actually all those
that have page-breaks defined in their styles.

The styles are defined in a separate style.xml file which comes from
ODT. Style names become CSS classnames in XHTML, so I can check by
@class value if a style has a page-break:
document('styles.xml')//style:style[@style:name =
'Quote']/style:paragraph-properties/@fo:break-before = 'page'

And here comes the question -- how can I define sibling recursion not
only on html:h1, but on html:* that have page-breaks? I hope it's
possible to understand..



Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
  Mulberry Technologies: A Consultancy Specializing in SGML and XML

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.