SlideShare a Scribd company logo
LOOSE-LEAF PUBLISHING
UsingAntenna House and CSS
Eliot Kimber
Contrext
Balisage 2019
About the Author
■ Independent consultant focusing on DITA
analysis, design, and implementation
■ Doing SGML and XML for cough 30 years cough
■ Founding member of the DITATechnical
Committee
■ Founding member of the XMLWorking Group
■ Co-editor of HyTime standard (ISO/IEC 10744)
■ Primary developer and founder of the DITA for
Publishers project (dita4publishers.org)
■ Author of DITA for Practitioners,Vol 1 (XML Press)
Balisage Pre-Conference Symposium 2019 2
Agenda
■ What?
■ Why?
■ CSS paged media
■ Producing Point Pages
■ Conclusions and Further Work
Balisage Pre-Conference Symposium 2019 3
WHAT?
Balisage Pre-Conference Symposium 2019 4
The Client: Municode
■ Leading supplier of
municipal code
■ 2000+ clients
■ Replacing outdated
typesetting system that was
obsolete 20 years ago
– But it does loose leaf
■ Shifting focus from print to
digital
■ Print still essential
■ Looking for process
improvements
Balisage Pre-Conference Symposium 2019 5
Target System
■ CSS for pagination
■ Antenna House Formatter
for rendering to PDF
■ Custom processing to
implement loose leaf
■ Same source used for web
delivery
■ Source authored as highly-
constrained HTML5
■ Change boundaries are
marked manually
– Automatic detection of
changes is not a
requirement
Balisage Pre-Conference Symposium 2019 6
What Is Loose Leaf?
■ Pages that reflect changes
from the previously-
published version
■ Page numbers are not
changed
■ If pages are added, create
“point pages”: 12.1, 12.2, etc.
Balisage Pre-Conference Symposium 2019 7
WHY LOOSE LEAF?
Balisage Pre-Conference Symposium 2019 8
The Use Case: Municipal Code
■ Muncipal code is the codified
laws for a city, town, county
or similar legal entity
■ Can be 1000s of pages
■ Updated frequently
– Every city council meeting
Balisage Pre-Conference Symposium 2019 9
Balisage Pre-Conference Symposium 2019 10
Why Loose Leaf?
■ People who use the code
depend on their paper copies
■ Would be impractical to
republish and redistribute for
every update
■ Loose leaf is the only
practical solution for paper
updates here
Balisage Pre-Conference Symposium 2019 11
Why CSS for Pagination?
■ Client insisted on it
■ Authoring directly in HTML5
■ Wanted to use a standard
technology
■ Did not have XSL-FO skills
and knowledge
■ Did not have XSLT skills and
knowledge
■ Layout requirements are
challenging but still
achievable (mostly)
■ Compelling cost advantages
– Easier to implement
– Separation of concerns
– Can hire CSS people
Balisage Pre-Conference Symposium 2019 12
Why Antenna House Formatter?
■ Most complete CSS paged
media implementation
■ Demonstrated ability to
meet layout requirements
■ Mature product with good
reputation
Balisage Pre-Conference Symposium 2019 13
CSS FOR PAGINATION
Balisage Pre-Conference Symposium 2019 14
CSS Paged Media
■ Adds rules, properties,
values, etc. to CSS
specifically for paged media
■ Page master definition
■ Page edge regions (running
heads and feet, etc.)
■ Generated text features
■ Additional typographic
features
■ Scattered across a number of
different specifications
■ Not fully baked
Balisage Pre-Conference Symposium 2019 15
Practical CSS Pagination Realities
■ Today only commercial tools
provide sufficiently complete
implementations
■ Proprietary extensions are
required to meet many
layout requirements
■ Need to preprocess HTML or
generate HTML from non-
XML source
■ Specs are constantly
changing
– Hard to find answers to
some questions
– Hard to keep up with
changes
■ No single source of practical
instruction (today)
– See Liam Quin and me
Balisage Pre-Conference Symposium 2019 16
CSSValue Proposition
■ Easy syntax to learn and use
compared to XSL-FO
■ Cleaner separation of
concerns between data
processing and visual design
■ Can share core CSS with
browser and paged
deliverables
■ CSS is “cool”
■ XSL-FO is “what the heck is
XSL-FO?”
■ Complexity of required XSLT
much lower
■ On balance: compelling
solution
Balisage Pre-Conference Symposium 2019 17
“Augmented HTML” is Required
■ CSS can only decorate
■ Need to synthesize:
– Tables of contents
– Indexes
– Complex running heads and
feet
■ Can simplify CSS by adding
containers or attributes
■ CSS has selector limitations
– Can’t look ahead
– May require new classes
based on descendants or
following elements
■ May need to reorder or
otherwise modify source as
authored
Balisage Pre-Conference Symposium 2019 18
CSS Example: @page Rule—Defines a
page master
@page portrait-first:right {
size: 8.5in 11in;
margin-left: 7.5pc;
margin-right: 7.5pc;
counter-reset: footnote;
counter-reset: page 1;
@bottom-left {
content: element(updateLabel);
vertical-align: top;
margin-top: 1pc;
font-family: "New Century Schoolbook", serif,
'Arial Unicode';
font-size: 8pt;
}
@bottom-center {
content: string(prefolio, first) '200B’
counter(page) '200B’
string(postfolio, first);
margin-top: 1pc;
vertical-align: top;
font-family: "New Century Schoolbook",
serif, 'Arial Unicode';
font-size: 10pt;
}
@bottom-right {
content: '00a0';
margin-top: 1pc;
vertical-align: top;
font-family: "New Century Schoolbook", serif,
'Arial Unicode';
font-size: 10pt;
}
}
Balisage Pre-Conference Symposium 2019 19
CSS Example: Start A Page Sequence
section[data-type = 'loep'],
section[data-type = 'supphistory']
{
page: portrait-first portrait;
break-before: right;
}
Balisage Pre-Conference Symposium 2019 20
Differences from XSL-FO
■ Any element can start a page
sequence
■ Edge region model different
(and more limited)
■ No table markers
■ No index entry features
■ No concept of “folio”–page
numbers are just counters
■ No flow model
■ Can use CSS grid (if
implementation supports it)
■ See LiamQuin for details
Balisage Pre-Conference Symposium 2019 21
PRODUCING POINT
PAGES
Balisage Pre-Conference Symposium 2019 22
The Challenges
■ Identifying pages in the
change set
■ Determining page numbers
for pages
– Changing page number
from formatter-assigned
page number
– Constructing point page
numbers
■ Ensuring change sets end on
even pages
■ Updating page numbers
■ Capturing page history
■ Generating full-doc tables of
contents
Balisage Pre-Conference Symposium 2019 23
General Solution:
Post Process the AreaTree
■ AHF can produce an “area
tree” document
■ XML representation of the
formatted pages
■ AHF can take area tree as
input to produce final forms
(PDF, etc.)
■ Area tree is not standard but
is reasonably stable
■ Structure is logical and easy
to understand
Balisage Pre-Conference Symposium 2019 24
<AreaRoot xmlns="http://www.antennahouse.com/names/XSL/AreaTree"
font-size="10pt" is-first="true" is-last="true" version="605.0"
is-CSS="true" display-role="root">
<PageViewportArea output-volume-break="false" generated-by="html" counter-reset="footnote"
is-first="true" is-link-destination="true" id="x99999" width="612pt" height="792pt"
abs-page-number="1" orig-abs-page-number="1" page-number="1" format="1" stacking-context="true"
display-role="root" in-job="false">
<PageReferenceArea generated-by="html" is-first="true" is-last="true" width="612pt"
height="792pt" display-role="block">
<PageRegionViewportArea region="none" generated-by="html" counter-reset="footnote"
is-first="true" is-last="true" top-position="36pt" bottom-position="36pt"
left-position="36pt" right-position="36pt" width="540pt" height="720pt" region-name=""
display-role="root">
<PageRegionReferenceArea generated-by="html" is-first="true" width="540pt" height="720pt"
display-role="block">
<BlockArea line-height="14pt" generated-by="html" text-align="justify"
font-family="&#34;New Century Schoolbook&#34;, serif" display="block" id="x99999"
font-size="10pt" is-first="true" bottom-position="395.75pt" width="540pt"
height="324.25pt" display-role="root">
General Challenge:
Injecting Additional Data Into AreaTree
■ Need to capture data needed
for post processing:
– Change set boundaries
– Imposed page numbers
– Source element type types
(section, figure, table,
generated, etc.)
– Page numbers with
structure
■ Three basic solutions:
1. Structured IDs
2. Magic character
conventions
3. Data in unused page edge
regions
■ Use “marker” elements to
inject arbitrary information
Balisage Pre-Conference Symposium 2019 25
Markers and Structured IDs
■ AHF necessarily captures IDs
of all elements that are not
explicitly omitted
■ Use ID values as structured
fields:
<areaTreeMarker
id="take:take-begin:job=S103:d20p61”
/>
<areaTreeMarker
id="marker:section:update-
ins:start:portrait:id=instruction_sheet"
>
■ Use CSS to key on ID values:
div.section-body
areaTreeMarker[id ^= 'take:take-begin']
{
display: block;
break-before: right;
}
section > section +
areaTreeMarker[id ^= 'take:take-end'],
section > section >
areaTreeMarker[id ^= 'take:take-end'],
div.section-body
areaTreeMarker[id ^= 'take:take-end']
{
display: block;
break-after: right;
}
Balisage Pre-Conference Symposium 2019 26
Magic Characters:
Structured Page Numbers
■ Display page numbers have
three parts:
– Prefolio (“CH-1”)
– Folio (the page number)
– Postfolio (“-”)
■ Need to distinguish for post
processing:
– Find page numbers
– Change the number
■ Solution:
– Use @class and @id for page
number references:
<span class="page" id="page:d2816e24">
<span
class="page-number-marker">&#x200B;</span>
<a id="pageref:d2816e27" class="frontmatter"
href="#x8A66ACBA2357"/>
<span class="page-number-marker”
>&#x200B;</span></span>
■ Use non-breaking space to
separate folio parts
Balisage Pre-Conference Symposium 2019 27
ToYour Corner:
Using Page Edge Regions
■ Capture page number
format
■ Capture numeric page
number
■ Use corner regions
<MarginRegionViewportArea
visibility="hidden"
region-name="bottom-right-corner">
<MarginRegionReferenceArea visibility="hidden"
display-role="block">
<BlockArea
visibility="hidden" display-role="block">
<LineArea visibility="hidden" display-role="block">
<TextArea text="^pnf:1" visibility="hidden"/>
</LineArea>
</BlockArea>
</MarginRegionReferenceArea>
</MarginRegionViewportArea>
Balisage Pre-Conference Symposium 2019 28
AreaTree Update Process
1. Set page number and
format
2. Update page numbers
3. Filter pages
4. Renumber absolute page
numbers
5. Final update processing
6. Update page number
database
Balisage Pre-Conference Symposium 2019 29
Updating Page Numbers
■ AHF generates normal
integer page numbers
■ Will need to change some
– Different start page
– Numbers pulled from page
database
– Point page numbers
■ Width of number will likely
change
■ In some contexts, need to
adjust the horizontal position
■ In particular,ToC entries
■ Challenge: how wide is the
new number?
Balisage Pre-Conference Symposium 2019 30
Page Number Widths Solution:
Generate Exemplars in the AreaTree
■ HTML preprocess generates
elements for each character
in each font and size:
<char-samples
id="util:char-samples">
<char-sample class="body">
<char-set class="number-set sz8pt"
id="util:char-set:body-sz8pt"
>
<decimal>.</decimal>
<char>0</char>
<char>1</char>
<char>2</char>...
</char-set>
...
</char-sample>
...
</char-samples>
■ In area tree, can look up by font
family, size, and character:
<xsl:key name="char-samples"
match="at:BlockArea[starts-with(@id,
'util:char-set:')]//at:TextArea"
use="at:make-char-sample-key(@font-family,
@font-size, @text)"
/>
...
<xsl:variable name="key" as="xs:string"
select="at:make-char-sample-key(
$font-family,
$font-size,
$text)"
/>
<xsl:variable name="result" as="element()?"
select="key('char-samples’,
$key,
root($context))[1]"
/>
Balisage Pre-Conference Symposium 2019 31
Page Number Database
■ Two parts:
– Record of each physical
page
– Mapping of elements to the
pages they started on
■ Updated when final version
is published
■ Serves:
– Update instructions
– List of effective pages
– Supplement history
– Table of contents
■ Implemented as a version-
controlled XML file today
Balisage Pre-Conference Symposium 2019 32
SUMMARY
Balisage Pre-Conference Symposium 2019 33
In Summary
■ It works!
■ Not that hard once I figured
out how to do it
■ CSS offers compelling
advantages…
■ …but requires commercial
solutions today
■ Hand marking of change sets
avoids a hard problem
■ Area tree is proprietary but it
is not opaque
Balisage Pre-Conference Symposium 2019 34
More to Be Done
■ Automatic detection of
changes
■ Auto-insertion of changed
pages
■ Better automate capturing
legacy page number data
■ Refine inefficient processing
■ Clean up area tree before
generating PDF
■ More robust page database
Balisage Pre-Conference Symposium 2019 35
Resources
CSS: https://www.w3.org/TR/#tr_Cascading_Style_Sheets_(CSS)_Working_Group
Antenna House Formatter: https://www.antennahouse.com/formatter/
CSS Pagination Book (rough draft): https://drmacro.github.io/css-pagination-book/
CSS training (Liam Quin): https://www.delightfulcomputing.com/course-css-for-
xml-people.html
Graham,Tony. “Decision making in XSL-FO formatting.” Presented at Balisage: The
Markup Conference 2013, Montréal, Canada, August 6 - 9, 2013. In Proceedings of
Balisage:The Markup Conference 2013. Balisage Series on MarkupTechnologies, vol.
10 (2013). https://doi.org/10.4242/BalisageVol10.Graham01.
Balisage Pre-Conference Symposium 2019 36

More Related Content

Similar to Loose Leaf Publishing Using Antenna House Formatter and CSS for Pagination

Starburst Presto - CBO talk - Strata London 2019
Starburst Presto  - CBO talk - Strata London 2019Starburst Presto  - CBO talk - Strata London 2019
Starburst Presto - CBO talk - Strata London 2019
Justin Borgman
 
Presto Strata London 2019: Cost-Based Optimizer for interactive SQL on anything
Presto Strata London 2019: Cost-Based Optimizer for interactive SQL on anythingPresto Strata London 2019: Cost-Based Optimizer for interactive SQL on anything
Presto Strata London 2019: Cost-Based Optimizer for interactive SQL on anything
Piotr Findeisen
 
Broaden your dev skillset with SharePoint branding options
Broaden your dev skillset with SharePoint branding optionsBroaden your dev skillset with SharePoint branding options
Broaden your dev skillset with SharePoint branding options
Eric Overfield
 
A quick guide to Css and java script
A quick guide to Css and  java scriptA quick guide to Css and  java script
A quick guide to Css and java script
AVINASH KUMAR
 
Brand Your Community Using Less and Gulp
Brand Your Community Using Less and GulpBrand Your Community Using Less and Gulp
Brand Your Community Using Less and Gulp
Salesforce Developers
 
Brand Your Community Using Less and Gulp
Brand Your Community Using Less and GulpBrand Your Community Using Less and Gulp
Brand Your Community Using Less and Gulp
shujiui
 
Getting a Quick Start with Visualforce
Getting a Quick Start with Visualforce Getting a Quick Start with Visualforce
Getting a Quick Start with Visualforce
Mohammed Safwat Abu Kwaik
 
Cis 363 milestone 1 and 2
Cis 363 milestone 1 and 2Cis 363 milestone 1 and 2
Cis 363 milestone 1 and 2helpido9
 
Enhancing SharePoint with Responsive Web Design
Enhancing SharePoint with Responsive Web DesignEnhancing SharePoint with Responsive Web Design
Enhancing SharePoint with Responsive Web Design
Eric Overfield
 
SPS Paris: Building great client-side web parts with spfx, pnp-js-core, React...
SPS Paris: Building great client-side web parts with spfx, pnp-js-core, React...SPS Paris: Building great client-side web parts with spfx, pnp-js-core, React...
SPS Paris: Building great client-side web parts with spfx, pnp-js-core, React...
Bill Ayers
 
D1 - Building Great Client-side Web Parts with SPFx, PnP-JS-Core, ReactJS and...
D1 - Building Great Client-side Web Parts with SPFx, PnP-JS-Core, ReactJS and...D1 - Building Great Client-side Web Parts with SPFx, PnP-JS-Core, ReactJS and...
D1 - Building Great Client-side Web Parts with SPFx, PnP-JS-Core, ReactJS and...
SPS Paris
 
Web Design Bootcamp - Day1
Web Design Bootcamp - Day1Web Design Bootcamp - Day1
Web Design Bootcamp - Day1Aslam Najeebdeen
 
Responsive Web Designed for your communication and marketing needs
Responsive Web Designed for your communication and marketing needsResponsive Web Designed for your communication and marketing needs
Responsive Web Designed for your communication and marketing needs
SEGIC
 
Using CSS Paging to Render DITA Documents
Using CSS Paging to Render DITA DocumentsUsing CSS Paging to Render DITA Documents
Using CSS Paging to Render DITA Documents
Contrext Solutions
 
Your Intranet, Your Way
Your Intranet, Your WayYour Intranet, Your Way
Your Intranet, Your Way
D'arce Hess
 
Using your DB2 SQL Skills with Hadoop and Spark
Using your DB2 SQL Skills with Hadoop and SparkUsing your DB2 SQL Skills with Hadoop and Spark
Using your DB2 SQL Skills with Hadoop and Spark
Cynthia Saracco
 
Pertemuan 7
Pertemuan 7Pertemuan 7
Pertemuan 7
beiharira
 
PrintCSS workshop XMLPrague 2020
PrintCSS workshop XMLPrague 2020PrintCSS workshop XMLPrague 2020
PrintCSS workshop XMLPrague 2020
Andreas Jung
 
Team styles
Team stylesTeam styles
Team styles
nathanscott
 
Exploring Critical Rendering Path
Exploring Critical Rendering PathExploring Critical Rendering Path
Exploring Critical Rendering Path
Raphael Amorim
 

Similar to Loose Leaf Publishing Using Antenna House Formatter and CSS for Pagination (20)

Starburst Presto - CBO talk - Strata London 2019
Starburst Presto  - CBO talk - Strata London 2019Starburst Presto  - CBO talk - Strata London 2019
Starburst Presto - CBO talk - Strata London 2019
 
Presto Strata London 2019: Cost-Based Optimizer for interactive SQL on anything
Presto Strata London 2019: Cost-Based Optimizer for interactive SQL on anythingPresto Strata London 2019: Cost-Based Optimizer for interactive SQL on anything
Presto Strata London 2019: Cost-Based Optimizer for interactive SQL on anything
 
Broaden your dev skillset with SharePoint branding options
Broaden your dev skillset with SharePoint branding optionsBroaden your dev skillset with SharePoint branding options
Broaden your dev skillset with SharePoint branding options
 
A quick guide to Css and java script
A quick guide to Css and  java scriptA quick guide to Css and  java script
A quick guide to Css and java script
 
Brand Your Community Using Less and Gulp
Brand Your Community Using Less and GulpBrand Your Community Using Less and Gulp
Brand Your Community Using Less and Gulp
 
Brand Your Community Using Less and Gulp
Brand Your Community Using Less and GulpBrand Your Community Using Less and Gulp
Brand Your Community Using Less and Gulp
 
Getting a Quick Start with Visualforce
Getting a Quick Start with Visualforce Getting a Quick Start with Visualforce
Getting a Quick Start with Visualforce
 
Cis 363 milestone 1 and 2
Cis 363 milestone 1 and 2Cis 363 milestone 1 and 2
Cis 363 milestone 1 and 2
 
Enhancing SharePoint with Responsive Web Design
Enhancing SharePoint with Responsive Web DesignEnhancing SharePoint with Responsive Web Design
Enhancing SharePoint with Responsive Web Design
 
SPS Paris: Building great client-side web parts with spfx, pnp-js-core, React...
SPS Paris: Building great client-side web parts with spfx, pnp-js-core, React...SPS Paris: Building great client-side web parts with spfx, pnp-js-core, React...
SPS Paris: Building great client-side web parts with spfx, pnp-js-core, React...
 
D1 - Building Great Client-side Web Parts with SPFx, PnP-JS-Core, ReactJS and...
D1 - Building Great Client-side Web Parts with SPFx, PnP-JS-Core, ReactJS and...D1 - Building Great Client-side Web Parts with SPFx, PnP-JS-Core, ReactJS and...
D1 - Building Great Client-side Web Parts with SPFx, PnP-JS-Core, ReactJS and...
 
Web Design Bootcamp - Day1
Web Design Bootcamp - Day1Web Design Bootcamp - Day1
Web Design Bootcamp - Day1
 
Responsive Web Designed for your communication and marketing needs
Responsive Web Designed for your communication and marketing needsResponsive Web Designed for your communication and marketing needs
Responsive Web Designed for your communication and marketing needs
 
Using CSS Paging to Render DITA Documents
Using CSS Paging to Render DITA DocumentsUsing CSS Paging to Render DITA Documents
Using CSS Paging to Render DITA Documents
 
Your Intranet, Your Way
Your Intranet, Your WayYour Intranet, Your Way
Your Intranet, Your Way
 
Using your DB2 SQL Skills with Hadoop and Spark
Using your DB2 SQL Skills with Hadoop and SparkUsing your DB2 SQL Skills with Hadoop and Spark
Using your DB2 SQL Skills with Hadoop and Spark
 
Pertemuan 7
Pertemuan 7Pertemuan 7
Pertemuan 7
 
PrintCSS workshop XMLPrague 2020
PrintCSS workshop XMLPrague 2020PrintCSS workshop XMLPrague 2020
PrintCSS workshop XMLPrague 2020
 
Team styles
Team stylesTeam styles
Team styles
 
Exploring Critical Rendering Path
Exploring Critical Rendering PathExploring Critical Rendering Path
Exploring Critical Rendering Path
 

More from Contrext Solutions

Stupid DITA Tricks: After-The-Fact Specialization: Treating Aircraft Manuals ...
Stupid DITA Tricks:After-The-Fact Specialization: Treating Aircraft Manuals ...Stupid DITA Tricks:After-The-Fact Specialization: Treating Aircraft Manuals ...
Stupid DITA Tricks: After-The-Fact Specialization: Treating Aircraft Manuals ...
Contrext Solutions
 
Definition of the DITA Glossary: Or How to Get Some Cool Glossary Tools for Free
Definition of the DITA Glossary: Or How to Get Some Cool Glossary Tools for FreeDefinition of the DITA Glossary: Or How to Get Some Cool Glossary Tools for Free
Definition of the DITA Glossary: Or How to Get Some Cool Glossary Tools for Free
Contrext Solutions
 
Twisted XSL Tricks: Column Switching for FOP
Twisted XSL Tricks: Column Switching for FOPTwisted XSL Tricks: Column Switching for FOP
Twisted XSL Tricks: Column Switching for FOP
Contrext Solutions
 
Can I Have a Word: Managing Shared Glossaries and References to Terms With DITA
Can I Have a Word: Managing Shared Glossaries and References to Terms With DITACan I Have a Word: Managing Shared Glossaries and References to Terms With DITA
Can I Have a Word: Managing Shared Glossaries and References to Terms With DITA
Contrext Solutions
 
Ki, Qi, Key: The Way of DITA Harmony With Keys and Key References
Ki, Qi, Key: The Way of DITA Harmony With Keys and Key ReferencesKi, Qi, Key: The Way of DITA Harmony With Keys and Key References
Ki, Qi, Key: The Way of DITA Harmony With Keys and Key References
Contrext Solutions
 
Content Management on Zero Budget: DITA for Small Teams
Content Management on Zero Budget: DITA for Small TeamsContent Management on Zero Budget: DITA for Small Teams
Content Management on Zero Budget: DITA for Small Teams
Contrext Solutions
 
Locale-Aware Sorting and Text Handling in the Open Toolkit
Locale-Aware Sorting and Text Handling in the Open ToolkitLocale-Aware Sorting and Text Handling in the Open Toolkit
Locale-Aware Sorting and Text Handling in the Open Toolkit
Contrext Solutions
 
DITA for Small Teams Workshop (Tekom 2017)
DITA for Small Teams Workshop (Tekom 2017)DITA for Small Teams Workshop (Tekom 2017)
DITA for Small Teams Workshop (Tekom 2017)
Contrext Solutions
 
Can I Have a Word: Managing Shared Glossaries and References to Terms With DITA
Can I Have a Word: Managing Shared Glossaries and References to Terms With DITACan I Have a Word: Managing Shared Glossaries and References to Terms With DITA
Can I Have a Word: Managing Shared Glossaries and References to Terms With DITA
Contrext Solutions
 
XSLT Magic Tricks with DITA and FrameMaker
XSLT Magic Tricks with DITA and FrameMakerXSLT Magic Tricks with DITA and FrameMaker
XSLT Magic Tricks with DITA and FrameMaker
Contrext Solutions
 
FrameMaker and the DITA Open Toolkit
FrameMaker and the DITA Open ToolkitFrameMaker and the DITA Open Toolkit
FrameMaker and the DITA Open Toolkit
Contrext Solutions
 
DITA Reuse Challenges and Response
DITA Reuse Challenges and ResponseDITA Reuse Challenges and Response
DITA Reuse Challenges and Response
Contrext Solutions
 
RELAX NG and DITA: An Almost Perfect Match
RELAX NG and DITA: An Almost Perfect MatchRELAX NG and DITA: An Almost Perfect Match
RELAX NG and DITA: An Almost Perfect Match
Contrext Solutions
 
Managing Multiple Open Toolkit Configurations Using git Lightning Talk
Managing Multiple Open Toolkit Configurations Using git Lightning TalkManaging Multiple Open Toolkit Configurations Using git Lightning Talk
Managing Multiple Open Toolkit Configurations Using git Lightning Talk
Contrext Solutions
 
DITA OT Day 2015 Lightning Talk On The DITA Community Project
DITA OT Day 2015 Lightning Talk On The DITA Community ProjectDITA OT Day 2015 Lightning Talk On The DITA Community Project
DITA OT Day 2015 Lightning Talk On The DITA Community Project
Contrext Solutions
 
Why Is DITA So Hard?
Why Is DITA So Hard?Why Is DITA So Hard?
Why Is DITA So Hard?
Contrext Solutions
 
They Worked Before, What Happened? Understanding DITA Cross-Book Links
They Worked Before, What Happened? Understanding DITA Cross-Book Links They Worked Before, What Happened? Understanding DITA Cross-Book Links
They Worked Before, What Happened? Understanding DITA Cross-Book Links
Contrext Solutions
 
No Ki Magic: Managing Complex DITA Hyperdocuments
No Ki Magic: Managing Complex DITA HyperdocumentsNo Ki Magic: Managing Complex DITA Hyperdocuments
No Ki Magic: Managing Complex DITA Hyperdocuments
Contrext Solutions
 
Poster: Cross-Document Linking in DITA
Poster: Cross-Document Linking in DITAPoster: Cross-Document Linking in DITA
Poster: Cross-Document Linking in DITA
Contrext Solutions
 
DITA for Small Teams
DITA for Small TeamsDITA for Small Teams
DITA for Small Teams
Contrext Solutions
 

More from Contrext Solutions (20)

Stupid DITA Tricks: After-The-Fact Specialization: Treating Aircraft Manuals ...
Stupid DITA Tricks:After-The-Fact Specialization: Treating Aircraft Manuals ...Stupid DITA Tricks:After-The-Fact Specialization: Treating Aircraft Manuals ...
Stupid DITA Tricks: After-The-Fact Specialization: Treating Aircraft Manuals ...
 
Definition of the DITA Glossary: Or How to Get Some Cool Glossary Tools for Free
Definition of the DITA Glossary: Or How to Get Some Cool Glossary Tools for FreeDefinition of the DITA Glossary: Or How to Get Some Cool Glossary Tools for Free
Definition of the DITA Glossary: Or How to Get Some Cool Glossary Tools for Free
 
Twisted XSL Tricks: Column Switching for FOP
Twisted XSL Tricks: Column Switching for FOPTwisted XSL Tricks: Column Switching for FOP
Twisted XSL Tricks: Column Switching for FOP
 
Can I Have a Word: Managing Shared Glossaries and References to Terms With DITA
Can I Have a Word: Managing Shared Glossaries and References to Terms With DITACan I Have a Word: Managing Shared Glossaries and References to Terms With DITA
Can I Have a Word: Managing Shared Glossaries and References to Terms With DITA
 
Ki, Qi, Key: The Way of DITA Harmony With Keys and Key References
Ki, Qi, Key: The Way of DITA Harmony With Keys and Key ReferencesKi, Qi, Key: The Way of DITA Harmony With Keys and Key References
Ki, Qi, Key: The Way of DITA Harmony With Keys and Key References
 
Content Management on Zero Budget: DITA for Small Teams
Content Management on Zero Budget: DITA for Small TeamsContent Management on Zero Budget: DITA for Small Teams
Content Management on Zero Budget: DITA for Small Teams
 
Locale-Aware Sorting and Text Handling in the Open Toolkit
Locale-Aware Sorting and Text Handling in the Open ToolkitLocale-Aware Sorting and Text Handling in the Open Toolkit
Locale-Aware Sorting and Text Handling in the Open Toolkit
 
DITA for Small Teams Workshop (Tekom 2017)
DITA for Small Teams Workshop (Tekom 2017)DITA for Small Teams Workshop (Tekom 2017)
DITA for Small Teams Workshop (Tekom 2017)
 
Can I Have a Word: Managing Shared Glossaries and References to Terms With DITA
Can I Have a Word: Managing Shared Glossaries and References to Terms With DITACan I Have a Word: Managing Shared Glossaries and References to Terms With DITA
Can I Have a Word: Managing Shared Glossaries and References to Terms With DITA
 
XSLT Magic Tricks with DITA and FrameMaker
XSLT Magic Tricks with DITA and FrameMakerXSLT Magic Tricks with DITA and FrameMaker
XSLT Magic Tricks with DITA and FrameMaker
 
FrameMaker and the DITA Open Toolkit
FrameMaker and the DITA Open ToolkitFrameMaker and the DITA Open Toolkit
FrameMaker and the DITA Open Toolkit
 
DITA Reuse Challenges and Response
DITA Reuse Challenges and ResponseDITA Reuse Challenges and Response
DITA Reuse Challenges and Response
 
RELAX NG and DITA: An Almost Perfect Match
RELAX NG and DITA: An Almost Perfect MatchRELAX NG and DITA: An Almost Perfect Match
RELAX NG and DITA: An Almost Perfect Match
 
Managing Multiple Open Toolkit Configurations Using git Lightning Talk
Managing Multiple Open Toolkit Configurations Using git Lightning TalkManaging Multiple Open Toolkit Configurations Using git Lightning Talk
Managing Multiple Open Toolkit Configurations Using git Lightning Talk
 
DITA OT Day 2015 Lightning Talk On The DITA Community Project
DITA OT Day 2015 Lightning Talk On The DITA Community ProjectDITA OT Day 2015 Lightning Talk On The DITA Community Project
DITA OT Day 2015 Lightning Talk On The DITA Community Project
 
Why Is DITA So Hard?
Why Is DITA So Hard?Why Is DITA So Hard?
Why Is DITA So Hard?
 
They Worked Before, What Happened? Understanding DITA Cross-Book Links
They Worked Before, What Happened? Understanding DITA Cross-Book Links They Worked Before, What Happened? Understanding DITA Cross-Book Links
They Worked Before, What Happened? Understanding DITA Cross-Book Links
 
No Ki Magic: Managing Complex DITA Hyperdocuments
No Ki Magic: Managing Complex DITA HyperdocumentsNo Ki Magic: Managing Complex DITA Hyperdocuments
No Ki Magic: Managing Complex DITA Hyperdocuments
 
Poster: Cross-Document Linking in DITA
Poster: Cross-Document Linking in DITAPoster: Cross-Document Linking in DITA
Poster: Cross-Document Linking in DITA
 
DITA for Small Teams
DITA for Small TeamsDITA for Small Teams
DITA for Small Teams
 

Recently uploaded

The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 

Recently uploaded (20)

The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 

Loose Leaf Publishing Using Antenna House Formatter and CSS for Pagination

  • 1. LOOSE-LEAF PUBLISHING UsingAntenna House and CSS Eliot Kimber Contrext Balisage 2019
  • 2. About the Author ■ Independent consultant focusing on DITA analysis, design, and implementation ■ Doing SGML and XML for cough 30 years cough ■ Founding member of the DITATechnical Committee ■ Founding member of the XMLWorking Group ■ Co-editor of HyTime standard (ISO/IEC 10744) ■ Primary developer and founder of the DITA for Publishers project (dita4publishers.org) ■ Author of DITA for Practitioners,Vol 1 (XML Press) Balisage Pre-Conference Symposium 2019 2
  • 3. Agenda ■ What? ■ Why? ■ CSS paged media ■ Producing Point Pages ■ Conclusions and Further Work Balisage Pre-Conference Symposium 2019 3
  • 5. The Client: Municode ■ Leading supplier of municipal code ■ 2000+ clients ■ Replacing outdated typesetting system that was obsolete 20 years ago – But it does loose leaf ■ Shifting focus from print to digital ■ Print still essential ■ Looking for process improvements Balisage Pre-Conference Symposium 2019 5
  • 6. Target System ■ CSS for pagination ■ Antenna House Formatter for rendering to PDF ■ Custom processing to implement loose leaf ■ Same source used for web delivery ■ Source authored as highly- constrained HTML5 ■ Change boundaries are marked manually – Automatic detection of changes is not a requirement Balisage Pre-Conference Symposium 2019 6
  • 7. What Is Loose Leaf? ■ Pages that reflect changes from the previously- published version ■ Page numbers are not changed ■ If pages are added, create “point pages”: 12.1, 12.2, etc. Balisage Pre-Conference Symposium 2019 7
  • 8. WHY LOOSE LEAF? Balisage Pre-Conference Symposium 2019 8
  • 9. The Use Case: Municipal Code ■ Muncipal code is the codified laws for a city, town, county or similar legal entity ■ Can be 1000s of pages ■ Updated frequently – Every city council meeting Balisage Pre-Conference Symposium 2019 9
  • 11. Why Loose Leaf? ■ People who use the code depend on their paper copies ■ Would be impractical to republish and redistribute for every update ■ Loose leaf is the only practical solution for paper updates here Balisage Pre-Conference Symposium 2019 11
  • 12. Why CSS for Pagination? ■ Client insisted on it ■ Authoring directly in HTML5 ■ Wanted to use a standard technology ■ Did not have XSL-FO skills and knowledge ■ Did not have XSLT skills and knowledge ■ Layout requirements are challenging but still achievable (mostly) ■ Compelling cost advantages – Easier to implement – Separation of concerns – Can hire CSS people Balisage Pre-Conference Symposium 2019 12
  • 13. Why Antenna House Formatter? ■ Most complete CSS paged media implementation ■ Demonstrated ability to meet layout requirements ■ Mature product with good reputation Balisage Pre-Conference Symposium 2019 13
  • 14. CSS FOR PAGINATION Balisage Pre-Conference Symposium 2019 14
  • 15. CSS Paged Media ■ Adds rules, properties, values, etc. to CSS specifically for paged media ■ Page master definition ■ Page edge regions (running heads and feet, etc.) ■ Generated text features ■ Additional typographic features ■ Scattered across a number of different specifications ■ Not fully baked Balisage Pre-Conference Symposium 2019 15
  • 16. Practical CSS Pagination Realities ■ Today only commercial tools provide sufficiently complete implementations ■ Proprietary extensions are required to meet many layout requirements ■ Need to preprocess HTML or generate HTML from non- XML source ■ Specs are constantly changing – Hard to find answers to some questions – Hard to keep up with changes ■ No single source of practical instruction (today) – See Liam Quin and me Balisage Pre-Conference Symposium 2019 16
  • 17. CSSValue Proposition ■ Easy syntax to learn and use compared to XSL-FO ■ Cleaner separation of concerns between data processing and visual design ■ Can share core CSS with browser and paged deliverables ■ CSS is “cool” ■ XSL-FO is “what the heck is XSL-FO?” ■ Complexity of required XSLT much lower ■ On balance: compelling solution Balisage Pre-Conference Symposium 2019 17
  • 18. “Augmented HTML” is Required ■ CSS can only decorate ■ Need to synthesize: – Tables of contents – Indexes – Complex running heads and feet ■ Can simplify CSS by adding containers or attributes ■ CSS has selector limitations – Can’t look ahead – May require new classes based on descendants or following elements ■ May need to reorder or otherwise modify source as authored Balisage Pre-Conference Symposium 2019 18
  • 19. CSS Example: @page Rule—Defines a page master @page portrait-first:right { size: 8.5in 11in; margin-left: 7.5pc; margin-right: 7.5pc; counter-reset: footnote; counter-reset: page 1; @bottom-left { content: element(updateLabel); vertical-align: top; margin-top: 1pc; font-family: "New Century Schoolbook", serif, 'Arial Unicode'; font-size: 8pt; } @bottom-center { content: string(prefolio, first) '200B’ counter(page) '200B’ string(postfolio, first); margin-top: 1pc; vertical-align: top; font-family: "New Century Schoolbook", serif, 'Arial Unicode'; font-size: 10pt; } @bottom-right { content: '00a0'; margin-top: 1pc; vertical-align: top; font-family: "New Century Schoolbook", serif, 'Arial Unicode'; font-size: 10pt; } } Balisage Pre-Conference Symposium 2019 19
  • 20. CSS Example: Start A Page Sequence section[data-type = 'loep'], section[data-type = 'supphistory'] { page: portrait-first portrait; break-before: right; } Balisage Pre-Conference Symposium 2019 20
  • 21. Differences from XSL-FO ■ Any element can start a page sequence ■ Edge region model different (and more limited) ■ No table markers ■ No index entry features ■ No concept of “folio”–page numbers are just counters ■ No flow model ■ Can use CSS grid (if implementation supports it) ■ See LiamQuin for details Balisage Pre-Conference Symposium 2019 21
  • 23. The Challenges ■ Identifying pages in the change set ■ Determining page numbers for pages – Changing page number from formatter-assigned page number – Constructing point page numbers ■ Ensuring change sets end on even pages ■ Updating page numbers ■ Capturing page history ■ Generating full-doc tables of contents Balisage Pre-Conference Symposium 2019 23
  • 24. General Solution: Post Process the AreaTree ■ AHF can produce an “area tree” document ■ XML representation of the formatted pages ■ AHF can take area tree as input to produce final forms (PDF, etc.) ■ Area tree is not standard but is reasonably stable ■ Structure is logical and easy to understand Balisage Pre-Conference Symposium 2019 24 <AreaRoot xmlns="http://www.antennahouse.com/names/XSL/AreaTree" font-size="10pt" is-first="true" is-last="true" version="605.0" is-CSS="true" display-role="root"> <PageViewportArea output-volume-break="false" generated-by="html" counter-reset="footnote" is-first="true" is-link-destination="true" id="x99999" width="612pt" height="792pt" abs-page-number="1" orig-abs-page-number="1" page-number="1" format="1" stacking-context="true" display-role="root" in-job="false"> <PageReferenceArea generated-by="html" is-first="true" is-last="true" width="612pt" height="792pt" display-role="block"> <PageRegionViewportArea region="none" generated-by="html" counter-reset="footnote" is-first="true" is-last="true" top-position="36pt" bottom-position="36pt" left-position="36pt" right-position="36pt" width="540pt" height="720pt" region-name="" display-role="root"> <PageRegionReferenceArea generated-by="html" is-first="true" width="540pt" height="720pt" display-role="block"> <BlockArea line-height="14pt" generated-by="html" text-align="justify" font-family="&#34;New Century Schoolbook&#34;, serif" display="block" id="x99999" font-size="10pt" is-first="true" bottom-position="395.75pt" width="540pt" height="324.25pt" display-role="root">
  • 25. General Challenge: Injecting Additional Data Into AreaTree ■ Need to capture data needed for post processing: – Change set boundaries – Imposed page numbers – Source element type types (section, figure, table, generated, etc.) – Page numbers with structure ■ Three basic solutions: 1. Structured IDs 2. Magic character conventions 3. Data in unused page edge regions ■ Use “marker” elements to inject arbitrary information Balisage Pre-Conference Symposium 2019 25
  • 26. Markers and Structured IDs ■ AHF necessarily captures IDs of all elements that are not explicitly omitted ■ Use ID values as structured fields: <areaTreeMarker id="take:take-begin:job=S103:d20p61” /> <areaTreeMarker id="marker:section:update- ins:start:portrait:id=instruction_sheet" > ■ Use CSS to key on ID values: div.section-body areaTreeMarker[id ^= 'take:take-begin'] { display: block; break-before: right; } section > section + areaTreeMarker[id ^= 'take:take-end'], section > section > areaTreeMarker[id ^= 'take:take-end'], div.section-body areaTreeMarker[id ^= 'take:take-end'] { display: block; break-after: right; } Balisage Pre-Conference Symposium 2019 26
  • 27. Magic Characters: Structured Page Numbers ■ Display page numbers have three parts: – Prefolio (“CH-1”) – Folio (the page number) – Postfolio (“-”) ■ Need to distinguish for post processing: – Find page numbers – Change the number ■ Solution: – Use @class and @id for page number references: <span class="page" id="page:d2816e24"> <span class="page-number-marker">&#x200B;</span> <a id="pageref:d2816e27" class="frontmatter" href="#x8A66ACBA2357"/> <span class="page-number-marker” >&#x200B;</span></span> ■ Use non-breaking space to separate folio parts Balisage Pre-Conference Symposium 2019 27
  • 28. ToYour Corner: Using Page Edge Regions ■ Capture page number format ■ Capture numeric page number ■ Use corner regions <MarginRegionViewportArea visibility="hidden" region-name="bottom-right-corner"> <MarginRegionReferenceArea visibility="hidden" display-role="block"> <BlockArea visibility="hidden" display-role="block"> <LineArea visibility="hidden" display-role="block"> <TextArea text="^pnf:1" visibility="hidden"/> </LineArea> </BlockArea> </MarginRegionReferenceArea> </MarginRegionViewportArea> Balisage Pre-Conference Symposium 2019 28
  • 29. AreaTree Update Process 1. Set page number and format 2. Update page numbers 3. Filter pages 4. Renumber absolute page numbers 5. Final update processing 6. Update page number database Balisage Pre-Conference Symposium 2019 29
  • 30. Updating Page Numbers ■ AHF generates normal integer page numbers ■ Will need to change some – Different start page – Numbers pulled from page database – Point page numbers ■ Width of number will likely change ■ In some contexts, need to adjust the horizontal position ■ In particular,ToC entries ■ Challenge: how wide is the new number? Balisage Pre-Conference Symposium 2019 30
  • 31. Page Number Widths Solution: Generate Exemplars in the AreaTree ■ HTML preprocess generates elements for each character in each font and size: <char-samples id="util:char-samples"> <char-sample class="body"> <char-set class="number-set sz8pt" id="util:char-set:body-sz8pt" > <decimal>.</decimal> <char>0</char> <char>1</char> <char>2</char>... </char-set> ... </char-sample> ... </char-samples> ■ In area tree, can look up by font family, size, and character: <xsl:key name="char-samples" match="at:BlockArea[starts-with(@id, 'util:char-set:')]//at:TextArea" use="at:make-char-sample-key(@font-family, @font-size, @text)" /> ... <xsl:variable name="key" as="xs:string" select="at:make-char-sample-key( $font-family, $font-size, $text)" /> <xsl:variable name="result" as="element()?" select="key('char-samples’, $key, root($context))[1]" /> Balisage Pre-Conference Symposium 2019 31
  • 32. Page Number Database ■ Two parts: – Record of each physical page – Mapping of elements to the pages they started on ■ Updated when final version is published ■ Serves: – Update instructions – List of effective pages – Supplement history – Table of contents ■ Implemented as a version- controlled XML file today Balisage Pre-Conference Symposium 2019 32
  • 34. In Summary ■ It works! ■ Not that hard once I figured out how to do it ■ CSS offers compelling advantages… ■ …but requires commercial solutions today ■ Hand marking of change sets avoids a hard problem ■ Area tree is proprietary but it is not opaque Balisage Pre-Conference Symposium 2019 34
  • 35. More to Be Done ■ Automatic detection of changes ■ Auto-insertion of changed pages ■ Better automate capturing legacy page number data ■ Refine inefficient processing ■ Clean up area tree before generating PDF ■ More robust page database Balisage Pre-Conference Symposium 2019 35
  • 36. Resources CSS: https://www.w3.org/TR/#tr_Cascading_Style_Sheets_(CSS)_Working_Group Antenna House Formatter: https://www.antennahouse.com/formatter/ CSS Pagination Book (rough draft): https://drmacro.github.io/css-pagination-book/ CSS training (Liam Quin): https://www.delightfulcomputing.com/course-css-for- xml-people.html Graham,Tony. “Decision making in XSL-FO formatting.” Presented at Balisage: The Markup Conference 2013, Montréal, Canada, August 6 - 9, 2013. In Proceedings of Balisage:The Markup Conference 2013. Balisage Series on MarkupTechnologies, vol. 10 (2013). https://doi.org/10.4242/BalisageVol10.Graham01. Balisage Pre-Conference Symposium 2019 36