% $Id: //TEI/web/Software/passivetex/fotex.xmt#45 $, $Date: 2003/08/19 $
%
% PassiveTeX version 1.25
%
% Copyright 2003 Sebastian Rahtz/Oxford University  
%      <sebastian.rahtz@oucs.ox.ac.uk>
%
% Permission is hereby granted, free of charge, to any person obtaining
% a copy of this software and any associated documentation files (the
% ``Software''), to deal in the Software without restriction, including
% without limitation the rights to use, copy, modify, merge, publish,
% distribute, sublicense, and/or sell copies of the Software, and to
% permit persons to whom the Software is furnished to do so, subject to
% the following conditions:
% 
% The above copyright notice and this permission notice shall be included
% in all copies or substantial portions of the Software.
%
% Includes fixes from Tomas Bures <ghort@pauline.vellum.cz>
%                     Yura Zotov <yznews@hotbox.ru>
%                     Anton V. Boyarshinov <boyarsh@ru.echo.fr>
%                     Dirk Roorda <dirk.roorda@planet.nl>


% MODIFICATIONS IN XMLTEX (Dirk)
% allow an explicit inheritance of attributes

\gdef\XML@attrib@x#1#2{
    \gdef\XML@tempb##1#1##2##3##4\relax\relax{
	\global\let\inheritexplicit\relax
	{\set@display@protect
	\expandafter\ifx\csname#2\endcsname\inherit
		\global\let\inheritexplicit\noexpand
	\fi}%
	\ifx\inheritexplicit\relax
		\def##2{#2}%
	\fi
    ##1##4\relax\relax}}

% test whether an attribute was explicitly set on an element

\gdef\explicitattribute#1{
	{	\expandafter\def\csname#1-test\endcsname{\global\def\isexplicit{1}}
		\global\let\isexplicit\relax
		\def\XML@doattribute##1##2##3{\csname##2-test\endcsname}
		\the\XML@attribute@toks
	}
}

\DeclareNamespace{fotex}{http://www.tug.org/fotex}
\DeclareNamespace{fo}{http://www.w3.org/1999/XSL/Format}
\def\string@autoauto{autoauto}
\XMLstring\FirstOnPage<>first-starting-within-page</>
\XMLstring\LastOnPage<>last-starting-within-page</>
\XMLstring\LINK<>LINK</>
\XMLstring\file@urlprefix<>url(</>
\XMLstring\file@prefix<>file://</>
\XMLstring\file@shortprefix<>file:</>
\XMLstring\prop@width<>proportional-column-width(1)</>
\XMLstringX\@staticafter<>xsl-after</>
\XMLstringX\@staticbefore<>xsl-before</>
\XMLstringX\@staticstart<>xsl-start</>
\XMLstringX\att@NaN<>NaN</>
\XMLstringX\att@after<>after</>
\XMLstringX\att@all<>all</>
\XMLstringX\att@always<>always</>
\XMLstringX\att@any<>any</>
\XMLstringX\att@auto<>auto</>
\XMLstringX\att@autoeven<>auto-even</>
\XMLstringX\att@autoodd<>auto-odd</>
\XMLstringX\att@baseline<>baseline</>
\XMLstringX\att@before<>before</>
\XMLstringX\att@black<>black</>
\XMLstringX\att@blank<>blank</>
\XMLstringX\att@bottom<>bottom</>
\XMLstringX\att@centered<>center</>
\XMLstringX\att@endoneven<>end-on-even</>
\XMLstringX\att@endonodd<>end-on-odd</>
\XMLstringX\att@even<>even</>
\XMLstringX\att@evenpage<>even-page</>
\XMLstringX\att@false<>false</>
\XMLstringX\att@first<>first</>
\XMLstringX\att@first@starting@within@page<>first-starting-within-page</>
\XMLstringX\att@french<>french</>
\XMLstringX\att@last@starting@within@page<>last-starting-within-page</>
\XMLstringX\att@lr@tb<>lr-tb</>
\XMLstringX\att@maximum<>maximum</>
\XMLstringX\att@maximumuniform<>maximum-uniform</>
\XMLstringX\att@medium<>medium</>
\XMLstringX\att@no<>no</>
\XMLstringX\att@no@limit<>no-limit</>
\XMLstringX\att@none<>none</>
\XMLstringX\att@normal<>normal</>
\XMLstringX\att@nowrap<>no-wrap</>
\XMLstringX\att@odd<>odd</>
\XMLstringX\att@oddpage<>odd-page</>
\XMLstringX\att@page<>page</>
\XMLstringX\att@page@sequence<>page-sequence</>
\XMLstringX\att@pre<>pre</>
\XMLstringX\att@preserve<>preserve</>
\XMLstringX\att@relative<>relative</>
\XMLstringX\att@repeat<>repeat</>
\XMLstringX\att@replace<>replace</>
\XMLstringX\att@scaletofit<>scale-to-fit</>
\XMLstringX\att@scroll<>scroll</>
\XMLstringX\att@show<>show</>
\XMLstringX\att@smallcaps<>small-caps</>
\XMLstringX\att@solid<>solid</>
\XMLstringX\att@static<>static</>
\XMLstringX\att@sub<>sub</>
\XMLstringX\att@super<>super</>
\XMLstringX\att@thick<>thick</>
\XMLstringX\att@thin<>thin</>
\XMLstringX\att@tiny<>true</>
\XMLstringX\att@top<>top</>
\XMLstringX\att@transparent<>transparent</>
\XMLstringX\att@true<>true</>
\XMLstringX\att@uniform<>uniform</>
\XMLstringX\att@use@font@metrics<>use-font-metrics</>
\XMLstringX\att@visible<>visible</>
\XMLstringX\att@xsl@any<>xsl-any</>
\XMLstringX\att@xsl@footnote@separator<>xsl-footnote-separator</>
\XMLstringX\att@yes<>yes</>
\XMLstring\att@bodystart<>body-start()</>
\XMLstring\att@labelend<>label-end()</>
\XMLstringX\leader@pattern@space<>space</>
\XMLstringX\leader@pattern@rule<>rule</>
\XMLstringX\leader@pattern@dots<>dots</>
\XMLstringX\rule@style@dashed<>dashed</>
\XMLstringX\rule@style@dotted<>dotted</>
\XMLnamespaceattributeX{fo}{media-usage}{\FOmediausage}{}
%           The "media-usage" property is used to control 
%           how the selected display medium is used to 
%           present the page(s) specified by the stylesheet.
\XMLnamespaceattributeX{fo}{text-altitude}{\FOtextaltitude}{}
%          Specifies the "height" to be used for the ascent
%          above the dominant baseline
\XMLnamespaceattributeX{fo}{text-depth}{\FOtextdepth}{}
%          Specifies the "depth" to be used for the descent
%          below the domiant baseline.
%auto | absolute | fixed | inherit
%\XMLnamespaceattributeX{fo}{absolute-position}{\FOabsoluteposition}{auto}
%link | visited | active | hover | focus
%\XMLnamespaceattributeX{fo}{active-state}{\FOactivestate}{}
%auto | <percentage> | <length> | inherit
\XMLnamespaceattributeX{fo}{alignment-adjust}{\FOalignmentadjust}{auto}
%yes | no
%\XMLnamespaceattributeX{fo}{auto-restore}{\FOautorestore}{\inherit}
%<angle> | [[ left-side | far-left | left
%| center-left | center | center-right | right | far-right | right-side
%] || behind ] | leftwards | rightwards | inherit
%\XMLnamespaceattributeX{fo}{azimuth}{\FOazimuth}{\inherit}
%[<background-color> ||
%<background-image>
%|| <background-repeat> || <background-attachment> || <background-position>
%| ]]inherit
\XMLnamespaceattributeX{fo}{background}{\FObackground}{}
%scroll | fixed | inherit
%\XMLnamespaceattributeX{fo}{background-attachment}{\FObackgroundattachment}{scroll}
%<color> | transparent | inherit
\XMLnamespaceattribute{fo}{background-color}{\FObackgroundcolor}{transparent}
%<uri> | none | inherit
%\XMLnamespaceattributeX{fo}{background-image}{\FObackgroundimage}{none}
%[ [<percentage> | <length> ]{1,2} |
% [ [top | center | bottom] || [left | center | right] ] ] | inherit
%\XMLnamespaceattributeX{fo}{background-position}{\FObackgroundposition}{0\% 0\%}
%<percentage> | <length> |
%left | center | right | inherit
%\XMLnamespaceattributeX{fo}{background-position-horizontal}{\FObackgroundpositionhorizontal}{0\%}
%<percentage> | <length> |
%top | center | bottom | inherit
%\XMLnamespaceattributeX{fo}{background-position-vertical}{\FObackgroundpositionvertical}{0\%}
%repeat | repeat-x | repeat-y | no-repeat | inherit
%\XMLnamespaceattributeX{fo}{background-repeat}{\FObackgroundrepeat}{repeat}
%baseline | before-edge
%| text-before-edge | middle | after-edge
%| text-after-edge | ideographic | alphabetic | hanging | mathematical
%| inherit
%\XMLnamespaceattributeX{fo}{baseline-identifier}{\FObaselineidentifier}{}
%baseline | sub | super | <percentage> | <length> | inherit
\XMLnamespaceattributeX{fo}{baseline-shift}{\FObaselineshift}{baseline}
%blank | not-blank | any | inherit
\XMLnamespaceattributeX{fo}{blank-or-not-blank}{\FOblankornotblank}{any}
%auto | <length> | <percentage> | <length-range> | inherit
%\XMLnamespaceattributeX{fo}{block-progression-dimension}{\FOblockprogressiondimension}{auto}
%[ <border-width> || <border-style> || <color> ] | inherit
\XMLnamespaceattributeX{fo}{border}{\FOborder}{}
%<color> | inherit
\XMLnamespaceattribute{fo}{border-after-color}{\FOborderaftercolor}{\FOcolor}
%<border-style> | inherit
\XMLnamespaceattributeX{fo}{border-after-style}{\FOborderafterstyle}{none}
%<border-width> | <length-conditional> | inherit
\XMLnamespaceattribute{fo}{border-after-width}{\FOborderafterwidth}{medium}
%<color> | inherit
\XMLnamespaceattribute{fo}{border-before-color}{\FOborderbeforecolor}{\FOcolor}
%<border-style> | inherit
\XMLnamespaceattributeX{fo}{border-before-style}{\FOborderbeforestyle}{none}
%<border-width> | <length-conditional> | inherit
\XMLnamespaceattribute{fo}{border-before-width}{\FOborderbeforewidth}{medium}
\XMLnamespaceattributeX{fo}{border-collapse}{\FObordercollapse}{\inherit}
%<color>{1,4} | transparent | inherit
\XMLnamespaceattribute{fo}{border-color}{\FObordercolor}{black}
%<color> | inherit
\XMLnamespaceattribute{fo}{border-end-color}{\FOborderendcolor}{\FOcolor}
%<border-style> | inherit
\XMLnamespaceattributeX{fo}{border-end-style}{\FOborderendstyle}{none}
%<border-width> | inherit
\XMLnamespaceattributeX{fo}{border-end-width}{\FOborderendwidth}{medium}
\XMLnamespaceattributeX{fo}{border-separation}{\FOborderseparation}{\inherit}
%<length> <length>? | inherit
\XMLnamespaceattributeX{fo}{border-spacing}{\FOborderspacing}{\inherit}
%<color> | inherit
\XMLnamespaceattribute{fo}{border-start-color}{\FOborderstartcolor}{\FOcolor}
%<border-style> | inherit
\XMLnamespaceattributeX{fo}{border-start-style}{\FOborderstartstyle}{none}
%<border-width> | inherit
\XMLnamespaceattributeX{fo}{border-start-width}{\FOborderstartwidth}{medium}
%<border-style>{1,4} | inherit
\XMLnamespaceattributeX{fo}{border-style}{\FOborderstyle}{}
%<length> | <percentage> | auto | inherit
\XMLnamespaceattributeX{fo}{border-width}{\FOborderwidth}{}
\XMLnamespaceattributeX{fo}{border-bottom}{\FOborderbottom}{\LINK}
\XMLnamespaceattribute{fo}{border-bottom-color}{\FOborderbottomcolor}{\LINK}
\XMLnamespaceattributeX{fo}{border-bottom-style}{\FOborderbottomstyle}{\LINK}
\XMLnamespaceattributeX{fo}{border-bottom-width}{\FOborderbottomwidth}{\LINK}
\XMLnamespaceattributeX{fo}{border-left}{\FOborderleft}{\LINK}
\XMLnamespaceattribute{fo}{border-left-color}{\FOborderleftcolor}{\LINK}
\XMLnamespaceattributeX{fo}{border-left-style}{\FOborderleftstyle}{\LINK}
\XMLnamespaceattributeX{fo}{border-left-width}{\FOborderleftwidth}{\LINK}
\XMLnamespaceattributeX{fo}{border-right}{\FOborderright}{\LINK}
\XMLnamespaceattribute{fo}{border-right-color}{\FOborderrightcolor}{\LINK}
\XMLnamespaceattributeX{fo}{border-right-style}{\FOborderrightstyle}{\LINK}
\XMLnamespaceattributeX{fo}{border-right-width}{\FOborderrightwidth}{\LINK}
\XMLnamespaceattributeX{fo}{border-top}{\FObordertop}{\LINK}
\XMLnamespaceattribute{fo}{border-top-color}{\FObordertopcolor}{\LINK}
\XMLnamespaceattributeX{fo}{border-top-style}{\FObordertopstyle}{\LINK}
\XMLnamespaceattributeX{fo}{border-top-width}{\FObordertopwidth}{\LINK}


%<length> | <percentage> | auto | inherit
\XMLnamespaceattributeX{fo}{bottom}{\FObottom}{auto}
%auto | column | page | even-page | odd-page | inherit
\XMLnamespaceattributeX{fo}{break-after}{\FObreakafter}{auto}
%auto | column | page | even-page | odd-page | inherit
\XMLnamespaceattributeX{fo}{break-before}{\FObreakbefore}{auto}
%before | after | start | end | top | bottom | left | right | inherit
\XMLnamespaceattributeX{fo}{caption-side}{\FOcaptionside}{\inherit}
%<name>
\XMLnamespaceattributeX{fo}{case-name}{\FOcasename}{}
%<string>
\XMLnamespaceattributeX{fo}{case-title}{\FOcasetitle}{}
%<character>
\XMLnamespaceattribute{fo}{character}{\FOcharacter}{}
%start | end | left | right | both | none | inherit
\XMLnamespaceattributeX{fo}{clear}{\FOclear}{none}
%<shape> | auto | inherit
\XMLnamespaceattributeX{fo}{clip}{\FOclip}{auto}
%<color> | inherit
\XMLnamespaceattribute{fo}{color}{\FOcolor}{\inherit}
%<name> | inherit
\XMLnamespaceattributeX{fo}{color-profile-name}{\FOcolorprofilename}{}
%<number> | inherit
\XMLnamespaceattributeX{fo}{column-count}{\FOcolumncount}{1}
%<length> | <percentage> | inherit
\XMLnamespaceattributeX{fo}{column-gap}{\FOcolumngap}{12.0pt}
%<number>
\XMLnamespaceattributeX{fo}{column-number}{\FOcolumnnumber}{}
%<length>
\XMLnamespaceattribute{fo}{column-width}{\FOcolumnwidth}{}
%<string> | auto
%\XMLnamespaceattributeX{fo}{content-type}{\FOcontenttype}{auto}

%none | <country> | inherit
\XMLnamespaceattributeX{fo}{country}{\FOcountry}{\inherit}
%<cue-before> || <cue-after> | inherit
%\XMLnamespaceattributeX{fo}{cue}{\FOcue}{}
%<uri> | none | inherit 
%\XMLnamespaceattributeX{fo}{cue-after}{\FOcueafter}{none}
%<uri> | none | inherit 
%\XMLnamespaceattributeX{fo}{cue-before}{\FOcuebefore}{none}
%<length>
%\XMLnamespaceattributeX{fo}{destination-placement-offset}{\FOdestinationplacementoffset}{\z@}
%ltr | rtl | inherit
\XMLnamespaceattributeX{fo}{direction}{\FOdirection}{\inherit}
%auto | before | center | after | inherit
\XMLnamespaceattributeX{fo}{display-align}{\FOdisplayalign}{\inherit}
%auto | autosense-script | no-change | reset-size
%| ideographic | alphabetic | hanging | mathematical | inherit
%\XMLnamespaceattributeX{fo}{dominant-baseline}{\FOdominantbaseline}{auto}
%<angle> | below | level | above | higher | lower | inherit
%\XMLnamespaceattributeX{fo}{elevation}{\FOelevation}{\inherit}
%show | hide | inherit
\XMLnamespaceattributeX{fo}{empty-cells}{\FOemptycells}{\inherit}
%<length> | inherit
\XMLnamespaceattribute{fo}{end-indent}{\FOendindent}{\inherit}
%yes | no
%\XMLnamespaceattributeX{fo}{ends-row}{\FOendsrow}{no}
%<length> | <percentage> | inherit
\XMLnamespaceattributeX{fo}{extent}{\FOextent}{0.0pt}
%<uri-reference>
\XMLnamespaceattributeX{fo}{external-destination}{\FOexternaldestination}{}
%before | start | end | left | right | none | inherit
\XMLnamespaceattributeX{fo}{float}{\FOfloat}{none}
%<name>
\XMLnamespaceattributeX{fo}{flow-name}{\FOflowname}{}
%[ [ <font-style> || <font-variant>
%|| <font-weight> ]? <font-size> [ / <line-height>]? <font-family>
%] | caption | icon | menu | message-box | small-caption | status-bar
%| inherit
\XMLnamespaceattributeX{fo}{font}{\FOfont}{\inherit}
%[[ <family-name> | <generic-family> ],]* [<family-name> | <generic-family>] | inherit
\XMLnamespaceattributeX{fo}{font-family}{\FOfontfamily}{\inherit}
%\XMLnamespaceattributeX{fo}{font-selection-strategy}{\FOselectionstrategy}{auto}
%<absolute-size> | <relative-size> | <length> | <percentage> | inherit
\XMLnamespaceattribute{fo}{font-size}{\FOfontsize}{\inherit}
%<number> | none | inherit
\XMLnamespaceattributeX{fo}{font-size-adjust}{\FOfontsizeadjust}{\inherit}
%normal | wider | narrower | ultra-condensed
% | extra-condensed | condensed | semi-condensed | semi-expanded |
% expanded | extra-expanded | ultra-expanded |inherit
\XMLnamespaceattributeX{fo}{font-stretch}{\FOfontstretch}{\inherit}
%normal | italic | oblique |  backslant | inherit
\XMLnamespaceattributeX{fo}{font-style}{\FOfontstyle}{\inherit}
%normal | small-caps | inherit
\XMLnamespaceattributeX{fo}{font-variant}{\FOfontvariant}{\inherit}
%normal | bold | bolder | lighter | 100 | 200
% | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit
\XMLnamespaceattributeX{fo}{font-weight}{\FOfontweight}{\inherit}
%auto | even | odd | end-on-even | end-on-odd | no-force | inherit
\XMLnamespaceattributeX{fo}{force-page-count}{\FOforcepagecount}{auto}
%<string>
\XMLnamespaceattributeX{fo}{format}{\FOformat}{\inherit}
%<angle> | inherit
%\XMLnamespaceattributeX{fo}{glyph-orientation-horizontal}{\FOglyphorientationhorizontal}{\inherit}
%auto | <angle> | inherit
%\XMLnamespaceattributeX{fo}{glyph-orientation-vertical}{\FOglyphorientationvertical}{\inherit}
%<character>
\XMLnamespaceattributeX{fo}{grouping-separator}{\FOgroupingseparator}{}
%<number>
%\XMLnamespaceattributeX{fo}{grouping-size}{\FOgroupingsize}{}
%<length> | <percentage> | auto | inherit
\XMLnamespaceattributeX{fo}{height}{\FOheight}{auto}
%false | true | inherit
\XMLnamespaceattributeX{fo}{hyphenate}{\FOhyphenate}{\inherit}
%<character> | inherit
\XMLnamespaceattributeX{fo}{hyphenation-character}{\FOhyphenationcharacter}{\inherit}
%auto | column | page | inherit
%\XMLnamespaceattributeX{fo}{hyphenation-keep}{\FOhyphenationkeep}{\inherit}
%no-limit | <number> | inherit
%\XMLnamespaceattributeX{fo}{hyphenation-ladder-count}{\FOhyphenationladdercount}{\inherit}
%<number> | inherit
\XMLnamespaceattributeX{fo}{hyphenation-push-character-count}{\FOhyphenationpushcharactercount}{\inherit}
%<number> | inherit
%\XMLnamespaceattributeX{fo}{hyphenation-remain-character-count}{\FOhyphenationremaincharactercount}{\inherit}
% <id>
\XMLnamespaceattributeX{fo}{id}{\FOid}{}
%yes | no
%\XMLnamespaceattributeX{fo}{indicate-destination}{\FOindicatedestination}{no}
%auto | auto-odd | auto-even | <number> | inherit
\XMLnamespaceattributeX{fo}{initial-page-number}{\FOinitialpagenumber}{auto}
%auto | <length> | <percentage> | <length-range> | inherit
%\XMLnamespaceattributeX{fo}{inline-progression-dimension}{\FOinlineprogressiondimension}{auto}
%null string |  <idref>
\XMLnamespaceattributeX{fo}{internal-destination}{\FOinternaldestination}{}
%<keep> | inherit
\XMLnamespaceattributeX{fo}{keep-together}{\FOkeeptogether}{\inherit}
\XMLnamespaceattributeX{fo}{keep-together.within-line}{\FOkeeptogetherLine}{\inherit}
% since we dont support column keeps, use Page here (not)
\XMLnamespaceattributeX{fo}{keep-together.within-column}{\FOkeeptogetherColumn}{\inherit}
\XMLnamespaceattributeX{fo}{keep-together.within-page}{\FOkeeptogetherPage}{\inherit}
%<keep> | inherit
\XMLnamespaceattributeX{fo}{keep-with-next}{\FOkeepwithnext}{auto}
\XMLnamespaceattributeX{fo}{keep-with-next.within-line}{\FOkeepwithnextLine}{auto}
\XMLnamespaceattributeX{fo}{keep-with-next.within-column}{\FOkeepwithnextColumn}{auto}
\XMLnamespaceattributeX{fo}{keep-with-next.within-page}{\FOkeepwithnextPage}{auto}
%<keep> | inherit
\XMLnamespaceattributeX{fo}{keep-with-previous}{\FOkeepwithprevious}{auto}
\XMLnamespaceattributeX{fo}{keep-with-previous.within-line}{\FOkeepwithpreviousLine}{auto}
\XMLnamespaceattributeX{fo}{keep-with-previous.within-column}{\FOkeepwithpreviousColumn}{auto}
\XMLnamespaceattributeX{fo}{keep-with-previous.within-page}{\FOkeepwithpreviousPage}{auto}
%none | <language> | inherit
\XMLnamespaceattributeX{fo}{language}{\FOlanguage}{\inherit}
%<length> | <percentage> | inherit
\XMLnamespaceattributeX{fo}{last-line-end-indent}{\FOlastlineendindent}{\inherit}
%none | reference-area | page | inherit
 \XMLnamespaceattribute{fo}{leader-length.maximum}{\FOleaderlengthmaximum}{\textwidth}
% leader-length.minimum=0pt, .optimum=12.0pt, .maximum=100percent
 \XMLnamespaceattributeX{fo}{leader-alignment}{\FOleaderalignment}{\inherit}
 \XMLnamespaceattributeX{fo}{leader-length}{\FOleaderlength}{\inherit}
%space | rule | dots | use-content | inherit
 \XMLnamespaceattributeX{fo}{leader-pattern}{\FOleaderpattern}{\inherit}
%use-font-metrics | <length> | inherit
 \XMLnamespaceattributeX{fo}{leader-pattern-width}{\FOleaderpatternwidth}{\inherit}
%<length> | <percentage> | auto | inherit
 \XMLnamespaceattribute{fo}{leader-length.optimum}{\FOleaderlengthoptimum}{0pt}
 \XMLnamespaceattributeX{fo}{leader-length.minimum}{\FOleaderlengthminimum}{\z@}\XMLnamespaceattributeX{fo}{left}{\FOleft}{auto}
%normal | <length> | <space> | inherit
\XMLnamespaceattributeX{fo}{letter-spacing}{\FOletterspacing}{\inherit}
%auto | alphabetic | traditional
\XMLnamespaceattributeX{fo}{letter-value}{\FOlettervalue}{auto}
%ignore | preserve | treat-as-space | inherit
\XMLnamespaceattributeX{fo}{linefeed-treatment}{\FOlinefeedtreatment}{\inherit}
%normal | <length> | <number> | <percentage> | <space> | inherit
\XMLnamespaceattributeX{fo}{line-height}{\FOlineheight}{\inherit}
%consider-shifts | disregard-shifts | inherit
\XMLnamespaceattributeX{fo}{line-height-shift-adjustment}{\FOlineheightshiftadjustment}{\inherit}
%line-height | font-height | max-height | inherit
\XMLnamespaceattributeX{fo}{line-stacking-strategy}{\FOlinestackingstrategy}{\inherit}
%<margin-width>{1,4} | inherit 
\XMLnamespaceattributeX{fo}{margin}{\FOmargin}{}
\XMLnamespaceattributeX{fo}{margin-left}  {\FOmarginleft}  {0pt}
\XMLnamespaceattributeX{fo}{margin-right}  {\FOmarginright}  {0pt}
\XMLnamespaceattributeX{fo}{margin-top}  {\FOmargintop}  {0pt}
\XMLnamespaceattributeX{fo}{margin-bottom}  {\FOmarginbottom}  {0pt}
%<name>
\XMLnamespaceattributeX{fo}{marker-class-name}{\FOmarkerclassname}{}
%<name>
\XMLnamespaceattributeX{fo}{master-reference}{\FOmasterreference}{}
\XMLnamespaceattributeX{fo}{master-name}{\FOmastername}{}
%<length> | <percentage> | none | inherit 
\XMLnamespaceattributeX{fo}{max-height}{\FOmaxheight}{\z@}
%<number> | no-limit | inherit
\XMLnamespaceattributeX{fo}{maximum-repeats}{\FOmaximumrepeats}{no-limit}
%<length> | <percentage> | none | inherit
\XMLnamespaceattributeX{fo}{max-width}{\FOmaxwidth}{none}
%<length> | <percentage> | inherit 
\XMLnamespaceattributeX{fo}{min-height}{\FOminheight}{\z@}
%<length> | <percentage> | inherit
\XMLnamespaceattributeX{fo}{min-width}{\FOminwidth}{}
%<number>
\XMLnamespaceattributeX{fo}{number-columns-repeated}{\FOnumbercolumnsrepeated}{1}
%<number>
\XMLnamespaceattributeX{fo}{number-columns-spanned}{\FOnumbercolumnsspanned}{1}
%<number>
\XMLnamespaceattributeX{fo}{number-rows-spanned}{\FOnumberrowsspanned}{1}
%odd | even | any | inherit
\XMLnamespaceattributeX{fo}{odd-or-even}{\FOoddoreven}{any}
%<integer> | inherit
\XMLnamespaceattributeX{fo}{orphans}{\FOorphans}{\inherit}
%visible | hidden | scroll | auto | inherit
\XMLnamespaceattributeX{fo}{overflow}{\FOoverflow}{auto}
%<padding-width>{1,4} | inherit
\XMLnamespaceattributeX{fo}{padding}{\FOpadding}{\z@}
%<padding-width> | <length-conditional> | inherit
\XMLnamespaceattributeX{fo}{padding-after}{\FOpaddingafter}{\z@}
%<padding-width> | <length-conditional> | inherit
\XMLnamespaceattributeX{fo}{padding-before}{\FOpaddingbefore}{\z@}
%<padding-width> | inherit
\XMLnamespaceattributeX{fo}{padding-bottom}{\FOpaddingbottom}{\z@}
%<padding-width> | inherit
\XMLnamespaceattributeX{fo}{padding-end}{\FOpaddingend}{\z@}
%<padding-width> | inherit
\XMLnamespaceattributeX{fo}{padding-left}{\FOpaddingleft}{\z@}
%<padding-width> | inherit
\XMLnamespaceattributeX{fo}{padding-right}{\FOpaddingright}{\z@}
%<padding-width> | inherit
\XMLnamespaceattributeX{fo}{padding-start}{\FOpaddingstart}{\z@}
%<padding-width> | inherit
\XMLnamespaceattributeX{fo}{padding-top}{\FOpaddingtop}{\z@}
%auto | always | avoid | left | right | inherit
\XMLnamespaceattributeX{fo}{page-break-after}{\FOpagebreakafter}{auto}
%auto | always | avoid | left | right | inherit
\XMLnamespaceattributeX{fo}{page-break-before}{\FOpagebreakbefore}{auto}
%auto | indefinite | <length> | inherit
\XMLnamespaceattribute{fo}{page-height}{\FOpageheight}{auto}
%first | last | rest | any | inherit
\XMLnamespaceattributeX{fo}{page-position}{\FOpageposition}{any}
%auto | indefinite | <length> | inherit
\XMLnamespaceattribute{fo}{page-width}{\FOpagewidth}{auto}
%[<time> | <percentage>]{1,2} | inherit
%\XMLnamespaceattributeX{fo}{pause}{\FOpause}{}
%<time> | <percentage> | inherit
%\XMLnamespaceattributeX{fo}{pause-after}{\FOpauseafter}{}
%<time> | <percentage> | inherit
%\XMLnamespaceattributeX{fo}{pause-before}{\FOpausebefore}{}
%<frequency> | x-low | low | medium | high | x-high | inherit
%\XMLnamespaceattributeX{fo}{pitch}{\FOpitch}{\inherit}
%<number> | inherit
%\XMLnamespaceattributeX{fo}{pitch-range}{\FOpitchrange}{\inherit}
%<uri> mix? repeat? | auto | none | inherit 
%\XMLnamespaceattributeX{fo}{play-during}{\FOplayduring}{auto}
%static | relative | absolute | fixed | inherit
\XMLnamespaceattributeX{fo}{position}{\FOposition}{static}
%true | false | inherit
\XMLnamespaceattributeX{fo}{precedence}{\FOprecedence}{false}
%<length> | inherit
\XMLnamespaceattributeX{fo}{provisional-distance-between-starts}{\FOprovisionaldistancebetweenstarts}{\inherit}
%<length> | inherit
\XMLnamespaceattributeX{fo}{provisional-label-separation}{\FOprovisionallabelseparation}{\inherit}
% 0 | 90 | 180 | 270 | -90 | -180 | -270 | inherit
\XMLnamespaceattributeX{fo}{reference-orientation}{\FOreferenceorientation}{0}
%<idref> | inherit
%\XMLnamespaceattributeX{fo}{ref-id}{\FOrefid}{}
%xsl-region-body | xsl-region-start | xsl-region-end
%| xsl-region-before | xsl-region-after | xsl-before-float-separator
%| xsl-footnote-separator | <name>
\XMLnamespaceattributeX{fo}{region-name}{\FOregionname}{}
%before | baseline | inherit
\XMLnamespaceattributeX{fo}{relative-align}{\FOrelativealign}{\inherit}
%auto | static | relative | inherit
\XMLnamespaceattributeX{fo}{relative-position}{\FOrelativeposition}{static}
%auto | perceptual | relative-colorimetric | saturation | 
% absolute-colorimetric | inherit
%\XMLnamespaceattributeX{fo}{rendering-intent}{\FOrenderingintent}{auto}
%page | page-sequence | document
%\XMLnamespaceattributeX{fo}{retrieve-boundary}{\FOretrieveboundary}{page-sequence}
%<name>
\XMLnamespaceattributeX{fo}{retrieve-class-name}{\FOretrieveclassname}{}
%first-starting-within-page | first-including-carryover |
% last-starting-within-page | last-ending-within-page
\XMLnamespaceattributeX{fo}{retrieve-position}{\FOretrieveposition}{first-starting-within-page}
%<number> | inherit
%\XMLnamespaceattributeX{fo}{richness}{\FOrichness}{\inherit}
%<length> | <percentage> | auto | inherit
\XMLnamespaceattributeX{fo}{right}{\FOright}{auto}
%<string> | none | inherit
\XMLnamespaceattributeX{fo}{role}{\FOrole}{none}
%none | dotted | dashed | solid | double | groove
% | ridge | inherit
\XMLnamespaceattributeX{fo}{rule-style}{\FOrulestyle}{\inherit}
%<length>
\XMLnamespaceattributeX{fo}{rule-thickness}{\FOrulethickness}{\inherit}
%uniform | non-uniform | inherit
\XMLnamespaceattributeX{fo}{scaling}{\FOscaling}{uniform}
%auto | integer-pixels | resample-any-method | inherit
\XMLnamespaceattributeX{fo}{scaling-method}{\FOscalingmethod}{auto}
%true | false | inherit
\XMLnamespaceattributeX{fo}{score-spaces}{\FOscorespaces}{\inherit}
%none | auto | <script> | inherit
\XMLnamespaceattributeX{fo}{script}{\FOscript}{\inherit}
%replace | new
\XMLnamespaceattributeX{fo}{show-destination}{\FOshowdestination}{replace}
%<length>{1,2} | auto | landscape | portrait | inherit
\XMLnamespaceattributeX{fo}{size}{\FOsize}{auto}
%<uri>+ | none | inherit
%\XMLnamespaceattributeX{fo}{source-document}{\FOsourcedocument}{none}
%<space> | inherit
%\XMLnamespaceattributeX{fo}{space-after}{\FOspaceafter}{\z@}
%<space> | inherit
%\XMLnamespaceattributeX{fo}{space-before}{\FOspacebefore}{\z@}
%<space> | inherit
\XMLnamespaceattributeX{fo}{space-end}{\FOspaceend}{\z@}
%<space> | inherit
\XMLnamespaceattributeX{fo}{space-start}{\FOspacestart}{\z@}
%ignore | preserve | inherit
\XMLnamespaceattributeX{fo}{space-treatment}{\FOspacetreatment}{\inherit}
%none | all | inherit
\XMLnamespaceattributeX{fo}{span}{\FOspan}{none}
%normal | none | spell-out | inherit
%\XMLnamespaceattributeX{fo}{speak}{\FOspeak}{\inherit}
%once | always | inherit
%\XMLnamespaceattributeX{fo}{speak-header}{\FOspeakheader}{\inherit}
%digits | continuous | inherit
%\XMLnamespaceattributeX{fo}{speak-numeral}{\FOspeaknumeral}{\inherit}
%code | none | inherit
%\XMLnamespaceattributeX{fo}{speak-punctuation}{\FOspeakpunctuation}{\inherit}
%<number> | x-slow | slow | medium | fast
% | x-fast | faster | slower | inherit
%\XMLnamespaceattributeX{fo}{speech-rate}{\FOspeechrate}{\inherit}
% <uri> | inherit
\XMLnamespaceattributeX{fo}{src}{\FOsrc}{}
%<length> | inherit
\XMLnamespaceattribute{fo}{start-indent}{\FOstartindent}{\inherit}
%show | hide
\XMLnamespaceattributeX{fo}{starting-state}{\FOstartingstate}{show}
%yes | no
%\XMLnamespaceattributeX{fo}{starts-row}{\FOstartsrow}{no}
%<number> | inherit
%\XMLnamespaceattributeX{fo}{stress}{\FOstress}{\inherit}
%auto | suppress | retain | inherit
\XMLnamespaceattributeX{fo}{suppress-at-line-break}{\FOsuppressatlinebreak}{auto}
%xsl-preceding | xsl-following | xsl-any | <name>[ <name>]*
\XMLnamespaceattributeX{fo}{switch-to}{\FOswitchto}{xsl-any}
%auto | fixed | inherit
\XMLnamespaceattributeX{fo}{table-layout}{\FOtablelayout}{auto}
%yes | no
\XMLnamespaceattributeX{fo}{table-omit-footer-at-break}{\FOtableomitfooteratbreak}{no}
%yes | no
\XMLnamespaceattributeX{fo}{table-omit-header-at-break}{\FOtableomitheaderatbreak}{no}
%start | center | end | justify | inside | outside 
% | left | right | <string> | inherit
\XMLnamespaceattributeX{fo}{text-align}{\FOtextalign}{\inherit}
%relative | start | center | end | justify | inside
% | outside | left | right | <string> | inherit
\XMLnamespaceattributeX{fo}{text-align-last}{\FOtextalignlast}{\inherit}
%none | [ [ underline | no-underline] || [ overline | no-overline ]
%|| [ line-through | no-line-through ] || [ blink | no-blink ] ]| inherit
\XMLnamespaceattributeX{fo}{text-decoration}{\FOtextdecoration}{none}
%<length> | <percentage> | inherit
\XMLnamespaceattributeX{fo}{text-indent}{\FOtextindent}{\inherit}
%none | [<color> || <length> <length> <length>?
%,]* [<color> || <length> <length> <length>?] | inherit
\XMLnamespaceattributeX{fo}{text-shadow}{\FOtextshadow}{none}
%capitalize | uppercase | lowercase | none | 
\XMLnamespaceattributeX{fo}{text-transform}{\FOtexttransform}{\inherit}
%<length> | <percentage> | auto | inherit
\XMLnamespaceattributeX{fo}{top}{\FOtop}{auto}
%auto | yes | no | inherit
\XMLnamespaceattributeX{fo}{treat-as-word-space}{\FOtreataswordspace}{auto}
%normal | embed | bidi-override | inherit
\XMLnamespaceattributeX{fo}{unicode-bidi}{\FOunicodebidi}{normal}
%baseline | middle | sub | super | text-top |
%text-bottom | <percentage> | <length> | top | bottom | inherit
\XMLnamespaceattribute{fo}{vertical-align}{\FOverticalalign}{auto}
%visible | hidden | collapse | inherit
%\XMLnamespaceattributeX{fo}{visibility}{\FOvisibility}{visible}
%[[<specific-voice> | <generic-voice>
%],]* [<specific-voice> | <generic-voice> ] | inherit
%\XMLnamespaceattributeX{fo}{voice-family}{\FOvoicefamily}{\inherit}
%<number> | <percentage> | silent | x-soft
%| soft | medium | loud | x-loud | inherit
%\XMLnamespaceattributeX{fo}{volume}{\FOvolume}{\inherit}
%normal | pre | nowrap | inherit
\XMLnamespaceattributeX{fo}{white-space}{\FOwhitespace}{\inherit}
%false | true | inherit
\XMLnamespaceattributeX{fo}{white-space-collapse}{\FOwhitespacecollapse}{\inherit}
%<integer> | inherit
\XMLnamespaceattributeX{fo}{widows}{\FOwidows}{\inherit}
%<length> | <percentage> | auto | inherit
\XMLnamespaceattributeX{fo}{width}{\FOwidth}{auto}
%normal | <length> | <space> | inherit
\XMLnamespaceattributeX{fo}{word-spacing}{\FOwordspacing}{\inherit}
%no-wrap | wrap | inherit
\XMLnamespaceattributeX{fo}{wrap-option}{\FOwrapoption}{\inherit}
%lr-tb | rl-tb | tb-rl | lr | rl | tb | inherit
\XMLnamespaceattributeX{fo}{writing-mode}{\FOwritingmode}{lr-tb}
%<country-language> | inherit
%\XMLnamespaceattributeX{fo}{xml:lang}{\FOxmllang}{\inherit}
%auto | <integer> | inherit
\XMLnamespaceattributeX{fo}{z-index}{\FOzindex}{auto}
%-------------------------------
\XMLnamespaceattributeX{fotex}{column-align}{\FOcolumnalign}{}

% Added attribute which controls table-placement. 
% It has the same syntax as LaTeX (e.g. !tbh)
% Since XMLTeX doesn't process well attributes from another namespace, 
% I must use the workaround
%          with namespaces.
\XMLnamespaceattributeX{fo}{fotex:placement}{\FOkplacement}{}
\XMLname{fo:inline-container}{\FOInlineContainer}
\XMLname{fo:footnote-body}{\FOFootnoteBody}
\XMLname{fo:list-item-label}{\FOListItemLabel}
\XMLname{fo:list-item-body}{\FOListItemBody}
\XMLname{fo:table-cell}{\FOTableCell}
\XMLname{fo:table-row}{\FOTableRow}
\def\SpaceAttributes{
 \XMLattributeX{space-after.optimum}{\FOspaceafteroptimum}{\z@}
 \XMLattributeX{space-after.maximum}{\FOspaceaftermaximum}{\z@}
 \XMLattributeX{space-after.minimum}{\FOspaceafterminimum}{\z@}
 \XMLattributeX{space-before.optimum}{\FOspacebeforeoptimum}{\z@}
 \XMLattributeX{space-before.maximum}{\FOspacebeforemaximum}{\z@}
 \XMLattributeX{space-before.minimum}{\FOspacebeforeminimum}{\z@}
 \XMLattributeX{space-after}{\FOspaceafter}{}
 \XMLattributeX{space-before}{\FOspacebefore}{}
}
\gdef\Defaultx@fontfamily{Times-Roman}
\gdef\FOheadindent{\z@}
 \gdef\FOautorestore{no}
 \gdef\FOazimuth{center}
 \gdef\FObordercollapse{collapse}
 \gdef\FOborderseparation{\z@}
 \gdef\FOborderspacing{\z@}
 \gdef\FOcaptionside{before}
 \gdef\FOcolor{black}
 \gdef\FOcountry{none}
 \gdef\FOdirection{ltr}
 \gdef\FOdisplayalign{auto}
 \gdef\FOelevation{level}
 \gdef\FOemptycells{show}
 \gdef\FOendindent{\z@}
 \gdef\FOfont{}
 \gdef\FOfontfamily{Times-Roman}
 \gdef\FOfontsizeadjust{none}
 \gdef\FOfontsize{medium}
 \gdef\FOfontstretch{normal}
 \gdef\FOfontstyle{normal}
 \gdef\FOfontvariant{normal}
 \gdef\FOfontweight{normal}
 \gdef\FOformat{1}
 \gdef\FOglyphorientationhorizontal{0}
 \gdef\FOglyphorientationvertical{auto}
 \gdef\FOhyphenate{false}
 \gdef\FOhyphenationcharacter{-}
 \gdef\FOhyphenationkeep{none}
 \gdef\FOhyphenationladdercount{no-limit}
 \gdef\FOhyphenationpushcharactercount{2}
 \gdef\FOhyphenationremaincharactercount{2}
 \gdef\FOlanguage{none}
 \gdef\FOlastlineendindent{\z@}
 \gdef\FOleaderalignment{none}
 \gdef\FOleaderlength{}
 \gdef\FOleaderpattern{space}
 \gdef\FOleaderpatternwidth{}
 \gdef\FOletterspacing{normal}
 \gdef\FOlinefeedtreatment{treat-as-space}
 \gdef\FOlineheight{normal}
 \gdef\FOlineheightshiftadjustment{consider-shifts}
 \gdef\FOlinestackingstrategy{line-height}
 \gdef\FOorphans{2}
 \gdef\FOpagebreakinside{auto}
 \gdef\FOpitch{medium}
 \gdef\FOpitchrange{50}
 \gdef\FOprovisionaldistancebetweenstarts{24.0pt}
 \gdef\FOprovisionallabelseparation{6.0pt}
 \gdef\FOrelativealign{before}
 \gdef\FOrichness{50}
 \gdef\FOrulestyle{solid}
 \gdef\FOrulethickness{1.0pt}
 \gdef\FOscorespaces{true}
 \gdef\FOscript{auto}
 \gdef\FOspacetreatment{preserve}
% \gdef\FOspeak{normal}
% \gdef\FOspeakheader{once}
% \gdef\FOspeaknumeral{continuous}
% \gdef\FOspeakpunctuation{none}
% \gdef\FOspeechrate{medium}
 \gdef\FOstartindent{\z@}
% \gdef\FOstress{50}
 \gdef\FOtextalign{start}
 \gdef\FOtextalignlast{relative}
 \gdef\FOtextindent{\z@}
 \gdef\FOtexttransform{none}
% \gdef\FOvoicefamily{}
 \gdef\FOvolume{medium}
 \gdef\FOwhitespace{normal}
 \gdef\FOwhitespacecollapse{true}
 \gdef\FOwidows{2}
 \gdef\FOwordspacing{normal}
 \gdef\FOwrapoption{wrap}
%<margin-width> | inherit
 \gdef\FOmarginbottom{\z@}
%<margin-width> | inherit
\gdef\FOmarginleft{\z@}
%<margin-width> | inherit
\gdef\FOmarginright{\z@}
%<margin-width> | inherit
\gdef\FOmargintop{}

\gdef\FOkplacement{}

\XMLelement{fo:root}
  {\XMLnamespaceattributeX{fo}{fotex:spacing-style}{\FoTeXSpacingStyle}{normal}}
  {\documentclass{article}
   \usepackage{fotex}
   \begin{document}
   \pagestyle{empty}
   \FOSetHyphenation
   \FoTeXSetSpacingStyle
   %\ignorewhitespace
   }
  {\end{document}}


\XMLelement{fotex:inlinemath}
   {}
   {\(}
   {\)}
 

\XMLelement{fotex:equation}
   {}
   {\begin{equation}}
   {\end{equation}}
 

\XMLelement{fotex:displaymath}
   {}
   {\begin{displaymath}}
   {\end{displaymath}}     

\XMLelement{fotex:eqnarray}
 {}
 {\xmlgrab}
 {\begin{gather*}#1\end{gather*}}

\XMLelement{fotex:subeqn}
  {}
  {\xmlgrab}
  {\ifx\FOid\@empty
     \gdef\w@t{#1\nonumber\\}
   \else
% needs the global version
     \gdef\w@t{#1\label{\temp}\\}
   \fi
   \aftergroup\w@t}

\XMLelement{fotex:bookmark}
 {
  \XMLattributeX{fotex-bookmark-level}{\FOTEXbookmarklevel}{0}
  \XMLattributeX{fotex-bookmark-label}{\FOTEXbookmarklabel}{}
 }
 {\xmlgrab}
 {\protectCS\FOTEXbookmarklabel
   \let\ignorespaces\@empty
   \pdfbookmark[\FOTEXbookmarklevel]{#1}{\FOTEXbookmarklabel}}

\XMLelement{fo:block}
  {\SpaceAttributes}
  {%
  \ifx\FOspan\att@all
	\ifnum\NColumns>1\relax
  		\interendmulticols
	\fi
  \fi
  \ifnum\FOwidows>1\relax\widowpenalty10000\relax\else\widowpenalty0\relax\fi
  \ifnum\FOorphans>1\relax\clubpenalty10000\relax\else\clubpenalty0\relax\fi
  \FOBlockGrabfalse
  \FOexpandattributes
  \FOSetHyphenation
  \ifFOinOutput
     \ifx\FObackgroundcolor\att@transparent
        \ifx\FOborderstyle\att@solid
           \FOBlockGrabtrue
        \fi
     \else
        \FOBlockGrabtrue
     \fi
     \def\w@t{\FOOutputBlock}%
     \def\@whattodonext{\FOEndOutputBlock}%
     \DEBUG{Start of Output Block, \expandafter\meaning\w@t, \expandafter\meaning\@whattodonext}%
  \else
     \ifx\XML@parent\FOListItemLabel
        \def\w@t{\FOListBlock}%
        \def\@whattodonext{\FOEndBlock}%
     \else
% we care if a block is inside a table cell
        \ifnum\FOinTable>1\relax
			\FOinTable1\relax
           \def\w@t{\FOBoxedBlock{\CurrentCellWidth}}%
           \def\@whattodonext{\FOEndBoxedBlock}
        \else
        % we care if a block is a second or subsequent child of a list body
           \ifx\XML@parent\FOListItemBody
              \global\advance\FOListBlocks by 1\relax%
              \ifnum\FOListBlocks<2\relax\else\FOListInnerPartrue\fi
           \else
        % but also if its nested within a list body block
              \ifFOListBody
                 \FOListInnerPartrue
              \fi
           \fi
           \ifx\FObackgroundcolor\att@transparent
              \ifx\FOborderstyle\att@solid
                 \FOBlockGrabtrue
              \fi
           \else
              \FOBlockGrabtrue
           \fi
           \def\@whattodonext{\FOEndBlock}
           \def\w@t{\FONormalBlock}%
        \fi
     \fi
  \fi
  \w@t
  \ifx\FOkeeptogether\att@always\samepage\fi
  \ifx\FOkeeptogetherColumn\att@always\samepage\fi
  \ifx\FOkeeptogetherPage\att@always\samepage\fi
  %\usewhitespace\ignorespaces
  }
  {\ifx\FOkeeptogether\att@always\samepage\fi
  \ifx\FOkeeptogetherColumn\att@always\samepage\fi
  \ifx\FOkeeptogetherPage\att@always\samepage\fi
  \@whattodonext
  \ifx\FOspan\att@all
	\ifnum\NColumns>1\relax
  		\interbeginmulticols{\NColumns}%
  	\fi
  \fi
}

\XMLelement{fo:character}
  {}
  {
  \ifx\FOverticalalign\att@auto
    \let\FOverticalalign\FObaselineshift
  \fi
  \FO@character{\FOcharacter}}
  {}

\XMLelement{fo:external-graphic}
   {
%auto | <length> | <percentage> | inherit
\XMLattributeX{content-height}{\FOcontentheight}{auto}
%auto | <length> | <percentage> | inherit
\XMLattributeX{content-width}{\FOcontentwidth}{auto}
}
   {
{\utfeight@protect@chars\expandafter\FOfiletest\FOsrc\@empty\@empty\@empty\@empty\@empty\@empty\@empty\@}%
\ifx\FOwidth\att@auto
  \ifx\FOheight\att@auto%
	\relax%
  \else%
	\def\FOcontentheight{\FOheight}%
	\def\FOcontentwidth{auto}%
  \fi
\else
  \def\FOcontentwidth{\FOwidth}%
  \ifx\FOheight\att@auto%
	\def\FOcontentheight{auto}%
  \else%
	\def\FOcontentheight{\FOheight}%
  \fi
\fi
\ifx\FOcontentwidth\att@scaletofit
 \setkeys{Gin}{width=\hsize}%
\else
  \ifx\FOcontentwidth\att@auto\else\FOSetGWidth\fi
\fi
\ifx\FOcontentheight\att@scaletofit
 \setkeys{Gin}{height=\vsize}%
\else
 \ifx\FOcontentheight\att@auto\else\FOSetGHeight\fi
\fi
\def\aligntype{center}
\ifthenelse{\equal{\FOtextalign}{right}}{\def\aligntype{flushright}}{}
\ifthenelse{\equal{\FOtextalign}{left}}{\def\aligntype{flushleft}}{}
\def\Picscaled{\begin{\aligntype}\includegraphics{\FOsrcname}\end{\aligntype}}
\ifx\FOscaling\att@uniform\else\setkeys{Gin}{keepaspectratio=false}\fi
%\csname startQ@\FOtextalign\endcsname
\ifx\FOborderstyle\att@solid\fbox{\Picscaled}\else\Picscaled\fi
%\csname endQ@\FOtextalign\endcsname
 }
{}


\XMLelement{fo:block-container}
  {}
  {}
  {}

\XMLelement{fo:float}
  {\XMLattributeX{float}{\FOfloat}{float}}
  {\ifx\FOfloat\att@none
     \begin{figure}[!htp]
   \else
     \begin{figure}
   \fi
   \FOlabel}
  {\end{figure}}

\XMLelement{fo:flow}
  {}
  {\global\SimplePMRefs1\relax
  \FOSetHyphenation
  \ifnum\PrevNColumns>1\relax
  \else
  	\clearpage
  \fi
  \DEBUG{New page, \the\c@page, \PageNumber}%
  \ifx\PageNumber\att@auto
  \else
  	\ifx\PageNumber\att@autoeven
  		\ifodd\c@page
			\BlankPage
		\fi
 		\else
  			\ifx\PageNumber\att@autoodd
  				\ifodd\c@page
 				\else
					\BlankPage
				\fi
      		\else
    			\setcounter{page}{\PageNumber}%
    		\fi
   		\fi
  	\fi
  \ifx\@empty\pendingID\else
   \@bsphack
   \protected@write\@mainaux{}%
    {\string\newlabel{\pendingID}{{}{\expandafter\FOgeneratePage\FOformat\@null}{}{}{}}}%
   \@esphack
  \hyper@@anchor{\pendingID}{\relax}%
  \global\let\pendingID\@empty
  \fi
  
    \DEBUG{^^JStart page sequence, using layout \CurrentPageMaster, at page \the\c@page}%
  
   \setaccordingtomaster
   \xdef\PrevNColumns{\NColumns}%
   \ForcePageSetuptrue
   \ifnum\NColumns>1\relax
   		\nobeginmulticols{\NColumns}%
   \fi
%  \ifnum\NColumns>1\MulticolPendingtrue
%  \begin{multicols}{\NColumns}\fi
   }
  {
   \ForcePageSetupfalse
   \ifnum\NColumns>1\relax
   		\noendmulticols
   \else
   		\clearpage
   \fi
   \ifx\ForcePage\att@auto
   \else
% remember that we'll do a \clearpage next time anyway.
% so leave here on wrong sort of page
     \ifx\ForcePage\att@endoneven
       \ifodd\c@page\else\BlankPage\fi
     \else
        \ifx\ForcePage\att@endonodd
          \ifodd\c@page\BlankPage\fi
        \fi
     \fi
   \fi
   }

\XMLelement{fo:footnote-body}
  {}
  {}
  {}


\XMLelement{fo:footnote}
  {}
  {\xmlgrab}
  {\FOSaveFontSize\xmltextwochildren\FOplainfootmark\FOfoottext#1}

\XMLelement{fo:page-number-citation}
   {\XMLattributeX{ref-id}{\FOrefid}{}}
   {}
   {\fopagecitation}

\XMLelement{fotex:sort}
   {\XMLattributeX{range-char}{\FOrangechar}{\textendash}}
   {\let\fopagecitation\fosortpagecitation
    \global\sorttoks{}}
   {\global\sortcount-2\let\@elt\focompress@elt
    \let\fosep\@empty
    \let\foheld\relax
    \the\sorttoks
    \ifx\foheld\relax\else\FOrangechar\fi\foheld
   }

\XMLelement{fo:wrapper}
  {}
  {\FOSetFont{wrapper}\FOlabel}
  {}

\XMLelement{fo:leader}
  {}
  {
\leavevmode
\ifx\FOleaderpattern\leader@pattern@rule
  	\ifx\FOrulestyle\rule@style@dashed
    	\def\w@t{\cleaders\hbox{$\m@th \mkern1.5mu-\mkern1.5mu$}\hfil}%
   	\else
    	\ifx\FOrulestyle\rule@style@dotted
      		\def\w@t{\cleaders\hbox{$\m@th \mkern1.5mu.\mkern1.5mu$}\hfil}%
    	\else
      		\ifdim\FOrulethickness>\z@
        		\def\w@t{\leaders\hrule height \FOrulethickness\hfill}%
      		\else
        		\def\w@t{\hfill}%
      		\fi
    	\fi
   	\fi
\else
  	\ifx\FOleaderpattern\leader@pattern@dots
      	\def\w@t{\cleaders\hbox{$\m@th \mkern1.5mu.\mkern1.5mu$}\hfill}%
  	\else % space
      	\def\w@t{\hfill}%
  	\fi
\fi
\ifx\@empty\FOleaderlength
	\PercentToDimen{\FOleaderlengthoptimum}%
	\edef\leaderopt{\the\@tempdima}%
	\PercentToDimen{\FOleaderlengthminimum}%
	\edef\leadermin{\the\@tempdima}%
	\PercentToDimen{\FOleaderlengthmaximum}%
	\edef\leadermax{\the\@tempdima}%
	\@tempdima\leaderopt\relax
	\advance\@tempdima-\leadermin\relax
	\@tempdimb\leadermax\relax
	\advance\@tempdimb-\leaderopt\relax
	\LeaderLength\leaderopt plus \@tempdimb minus \@tempdima\relax
\else
	\PercentToDimen{\FOleaderlength}%
	\LeaderLength\@tempdima\relax
\fi
\ifdim\LeaderLength=\z@
	\w@t
\else
	\hbox to \LeaderLength{\w@t}%
\fi
   }
  {}
  
\catcode`\/\active

\XMLelement{fo:basic-link}
  {
\XMLattributeX{target-presentation-context}{\FOtargetpresentationcontext}{}
\XMLattributeX{target-processing-context}{\FOtargetprocessingcontext}{}
\XMLattributeX{target-stylesheet}{\FOtargetstylesheet}{}
 }
  {\xmlgrab}
  {
\ifx\FOverticalalign\att@auto
    \let\FOverticalalign\FObaselineshift
\fi
\begingroup
\utfeight@protect@chars\xdef\temp{\FOinternaldestination}%
\endgroup
\let\FOinternaldestination\temp
\begingroup
\utfeight@protect@chars\xdef\temp{\FOexternaldestination}%
\endgroup
\let\FOexternaldestination\temp
   \ifx\FOindicatedestination\att@yes
     \setkeys{Hyp}{pdfborder={0 0 1}}
   \fi
   \ifx\FOexternaldestination\@empty
    \hyperlink{\FOinternaldestination}{\FO@inlinesequence{#1}}%
    \let\FOinternaldestination\@empty
   \else
     \href{\FOexternaldestination}{#1}
% this breaks any real content in the link text
%      \expandafter\@basiclink\relax#1//\@nil#1\@nil\FOexternaldestination\@nil%
    \let\FOexternaldestination\@empty
    \fi
  }
\catcode`\/=12

\XMLelement{fo:inline-container}
  {}
  {}
  {}

\XMLelement{fo:list-block}
  {\SpaceAttributes}
  {\ifx\FOstartindent\att@bodystart
     \let\FOstartindent\z@
   \fi
   \ifx\FOendindent\att@labelend
     \let\FOendindent\z@
   \fi
   %\FOSetFont{normal}%
   \advance\FOinList by 1\relax
   %\ifnum\FOinList>1\relax\leavevmode\fi
   \edef\This@LineWidth{\the\linewidth}%
   \begin{list}{}{%
   \itemindent=\FOstartindent
   \PercentToDimen{\FOprovisionaldistancebetweenstarts}%
   \leftmargin=\@tempdima\relax
   \advance\leftmargin by \FOmarginleft
   \rightmargin=\FOmarginright
   \labelwidth=\@tempdima\relax
   \advance\labelwidth by -\FOprovisionallabelseparation
   \expandafter\csname List\FOtextalign\endcsname
   \labelsep\FOprovisionallabelseparation
   \itemsep\z@
   \parsep\z@
   \partopsep\z@
   \topsep\z@
   \parskip\z@
   \ifx\@empty\FOspacebefore
      \@tempdima\FOspacebeforeoptimum
      \advance\@tempdima by -\FOspacebeforeminimum
      \@tempdimb\FOspacebeforeoptimum
      \advance\@tempdimb by \FOspacebeforemaximum
      \topsep\FOspacebeforeoptimum plus \@tempdimb minus \@tempdima
    \else
      \topsep\FOspacebefore
    \fi
   }%
   \edef\This@LineWidth{\the\linewidth}%
  }
  {\end{list}%
   \global\linewidth\This@LineWidth\relax
   \advance\FOinList by -1\relax
%   \par
  }

\XMLelement{fo:list-item-body}
  {}
  {\ifx\FOstartindent\att@bodystart
     \let\FOstartindent\z@
   \fi
   \edef\This@FOListBlocks{\the\FOListBlocks}%
   \FOListBodytrue\global\FOListBlocks0}
  {\global\FOListBlocks\This@FOListBlocks\relax}

\XMLelement{fo:list-item-label}
  {}
  {\xmlgrab}
  {\ifx\FOstartindent\att@bodystart
     \let\FOstartindent\z@
   \fi
   \ifx\FOendindent\att@labelend
     \let\FOendindent\z@
   \fi
   \savebox{\ItemBox}{#1}\item[#1]\FOlabel}

\XMLelement{fo:list-item}
  {\SpaceAttributes}
  {\FOSetHyphenation
   \ifx\@empty\FOspacebefore
      \@tempdima\FOspacebeforeoptimum
      \advance\@tempdima by -\FOspacebeforeminimum
      \@tempdimb\FOspacebeforeoptimum
      \advance\@tempdimb by \FOspacebeforemaximum
      \vskip\FOspacebeforeoptimum plus \@tempdimb minus \@tempdima
    \else
      \ifdim\FOspacebefore=0pt\relax\else\vskip\FOspacebefore\fi
    \fi
   \FOlabel}
  {}

\XMLelement{fo:page-number}
  {}
  {}
  {\expandafter\FOgeneratePage\FOformat\@null}


\XMLelement{fo:page-sequence}
  {}
  {\let\CurrentPageMaster\FOmasterreference
   \let\pendingID\FOid
   \let\PageNumber\FOinitialpagenumber
   \let\ForcePage\FOforcepagecount
   \FOSetHyphenation
   \LoadLanguage{\FOlanguage}
   }
  {}

\XMLelement{fo:region-after}
  {}
  {\ifx\FOregionname\@empty
    \def\FOregionname{xsl-region-after}
  \fi
  \DEBUG{  Link [\FOMaster:after] to \FOregionname}
  \begingroup
     \utfeight@protect@chars
     \expandafter\xdef\csname\FOMaster:after\endcsname{\FOregionname}
     \expandafter\xdef\csname\FOMaster:after-extent\endcsname{\FOextent}
  \endgroup
  }
  {}


\XMLelement{fo:region-before}
  {}
  {\ifx\FOregionname\@empty
    \def\FOregionname{xsl-region-before}
  \fi
  \DEBUG{  Link [\FOMaster:before]  to \FOregionname}
    \begingroup
     \utfeight@protect@chars
     \expandafter\xdef\csname\FOMaster:before\endcsname{\FOregionname}
     \expandafter\xdef\csname\FOMaster:before-extent\endcsname{\FOextent}
  \endgroup
  }
  {}

\XMLelement{fo:region-body}
  {}
  {
  \ifx\FOmargin\@empty\relax\else
      \let\FOmarginright\FOmargin
      \let\FOmarginleft\FOmargin
      \let\FOmargintop\FOmargin
      \let\FOmarginbottom\FOmargin
  \fi
  \xdef\InnerBottomMargin{\FOmarginbottom}
  \xdef\InnerTopMargin{\FOmargintop}
  \xdef\InnerLeftMargin{\FOmarginleft}
  \xdef\InnerRightMargin{\FOmarginright}
  \ifx\FOregionname\@empty
    \def\FOregionname{xsl-region-body}
  \fi
  \DEBUG{ Set up [\FOMaster:\FOregionname] body content: \FOcolumngap|\FOcolumncount|\FOmarginbottom|\FOmargintop|}
    \begingroup
     \utfeight@protect@chars
  \expandafter\xdef\csname\FOMaster:\FOregionname\endcsname{\FOcolumngap|\FOcolumncount|\FOmarginbottom|\FOmargintop|}
    \endgroup
  }
 {}

\XMLelement{fo:static-content}
 {}
 {\xmlgrab}
 {\protectCS\FOflowname
  \FOSetStatic{#1}{\FOflowname}}

\XMLelement{fo:table-and-caption}
  {}
  { 
   \global\ColSpecs={}\NCols0
   \TableWidth\linewidth
   \advance\TableWidth by -\tabcolsep
   \advance\TableWidth by -\FOmarginleft
   \advance\TableWidth by -\FOmarginright
   \gdef\TableHeader{}
   \NoTableSetup
    \ifx\XML@parent\FOInlineContainer
      \ifnum\FOreferenceorientation=0
       \FOlabel
      \else
       \begin{sidewaystable}\FOlabel
      \fi
    \else
     \ifnum\FOreferenceorientation=0
% We process FOkplacement atribute to override the placement of the table.
       \ifx\FOkplacement\@empty
        \begin{table}[!htbp]\FOlabel
		 \else
		  \edef\ktable{\noexpand\begin{table}[\FOkplacement]}
        \ktable\FOlabel
		 \fi
      \else
       \begin{sidewaystable}\FOlabel
      \fi
    \fi
  }
  {\ifx\XML@parent\FOInlineContainer
      \ifnum\FOreferenceorientation=0
      \else
       \end{sidewaystable}
      \fi
   \else
     \ifnum\FOreferenceorientation=0
       \end{table}
      \else
       \end{sidewaystable}
      \fi
   \fi
   \NoTableFinish
  }

\XMLelement{fo:table-body}
  {  }
  {
   \FOFirstCelltrue
   \FOinTable1
   \saveinterlineskip
   \expandafter\NoTableStart{\TableHeader}%
 }
{
 \ifnum\NCols<1
  \typeout{Table end of no cols defined}
 \fi
 \NoTableEnd
}


\XMLelement{fo:table-caption}
  {}
  {}
  {\par}

\XMLelement{fo:table-cell}
  {
   \XMLattributeX{ends-row}{\FOendsrow}{false}
   \XMLattributeX{starts-row}{\FOstartsrow}{false}
  }
  {\xmlgrab}
  {\FOlabel
  \FOexpandattributes
  \FOinTable2
  \NoTableCell{#1}}


\XMLelement{fo:table-column}
 {
   \XMLattributeX{text-align}{\FOtextalign}{\inherit}
 }
 { 
  \@tempcnta0
  \loop\ifnum\FOnumbercolumnsrepeated>\@tempcnta
   \advance\@tempcnta by 1
   {\NoTableColumn}%
  \repeat
  }
 {}

\XMLelement{fo:table-header}
  {}
  {\xmlgrab}
  {\gdef\TableHeader{#1}}

\XMLelement{fo:table-row}
  {}
  {\xmlgrab}
  {\NoTableRow{#1}}

\XMLelement{fo:table}
  {}
  {
   \FOexpandattributes
   \global\ColSpecs={}\NCols0
   \TableWidth\linewidth
   \advance\TableWidth by -\FOmarginleft
   \advance\TableWidth by -\FOmarginright
   \gdef\TableHeader{}
   \NoTableSetup
   \vbox\bgroup\FOBorderTop
% 	\vskip2\lineskip

  }
  {\FOBorderBottom\egroup
   \NoTableFinish
  }

\XMLelement{fo:inline}
  {}
  {\xmlgrab}
  {
  %\usewhitespace\ignorespaces
  \ifx\FOverticalalign\att@auto
    \let\FOverticalalign\FObaselineshift
  \fi
  \FOlabel
  \ifx\FOborderstyle\att@solid
	\interpretwidth
   \FOboxedsequence{#1}%
  \else
      \FO@inlinesequence{#1}%
  \fi}

\XMLelement{fo:bidi-override}
 {}
 {\xmlgrab}
 {\typeout{fo:bidi-override NOT IMPLEMENTED}}

\XMLelement{fo:color-profile}
 {}
 {\xmlgrab}
 {\typeout{fo:color-profile NOT IMPLEMENTED}}

\XMLelement{fo:declarations}
 {}
 {\xmlgrab}
 {\typeout{fo:declarations NOT IMPLEMENTED}}

\XMLelement{fo:initial-property-set}
 {}
 {\xmlgrab}
 {\typeout{fo:initial-property-set NOT IMPLEMENTED}}

\XMLelement{fo:instream-foreign-object}
 {}
 {\xmlgrab}
 {\typeout{fo:instream-foreign-object NOT IMPLEMENTED}}

\XMLelement{fo:marker}
 {}
 {\xmlgrab}
 {\toks@{}%
  \expandafter\FOaddmarker\FOmarks\relax{}%
  \toks@\expandafter{\the\expandafter\toks@\expandafter{\FOmarkerclassname}{#1}}%
  \xdef\FOmarks{\the\toks@}%
  \mark{\FOmarks}}

\XMLelement{fo:retrieve-marker}
 {}
 {\xmlgrab}
 {\begingroup
       \utfeight@protect@chars
\ifx\FOretrieveposition\att@first@starting@within@page
   \xdef\FOthismark{\firstmark}%
\else
   \ifx\FOretrieveposition\att@last@starting@within@page
       \xdef\FOthismark{\botmark}%
   \else
       \xdef\FOthismark{\firstmark}%
   \fi
\fi
       \xdef\FOthisretrieveclassname{\FOretrieveclassname}
   \endgroup
   \expandafter\FOgetmarker\FOthismark\relax\relax}

\XMLelement{fo:multi-case}
 {}
 {\xmlgrab}
 {\typeout{fo:multi-case NOT IMPLEMENTED}}

\XMLelement{fo:multi-properties}
 {}
 {\xmlgrab}
 {\typeout{fo:multi-properties NOT IMPLEMENTED}}

\XMLelement{fo:multi-property-set}
 {}
 {\xmlgrab}
 {\typeout{fo:multi-property-set NOT IMPLEMENTED}}

\XMLelement{fo:multi-switch}
 {}
 {\xmlgrab}
 {\typeout{fo:multi-switch NOT IMPLEMENTED}}

\XMLelement{fo:multi-toggle}
 {}
 {\xmlgrab}
 {\typeout{fo:multi-toggle NOT IMPLEMENTED}}

\XMLelement{fo:region-end}
 {}
 {\xmlgrab}
 {\typeout{fo:region-end NOT IMPLEMENTED}}

\XMLelement{fo:region-start}
 {}
 {\xmlgrab}
 {\typeout{fo:region-start NOT IMPLEMENTED}}

\XMLelement{fo:table-footer}
 {}
 {\xmlgrab}
 {\typeout{fo:table-footer NOT IMPLEMENTED}}


\XMLelement{fo:layout-master-set}
  {}
  {\DEBUG{Start defining page masters}}
  {\DEBUG{Finish defining page masters}}

\XMLelement{fo:page-sequence-master}
  {}
  {\global\SimplePMRefs0\relax
   \DEBUG{Page sequence master: \FOmastername}
   \let\Granpa\FOmastername
  }
  {\global\SimplePMRefs0\relax}

\XMLelement{fo:single-page-master-reference}
   {}
   {\global\advance\SimplePMRefs1\relax
	\DEBUG{ (single page \the\SimplePMRefs\space in \Granpa: use master \FOmasterreference)}
    \begingroup
    \utfeight@protect@chars
      \expandafter\xdef\csname Lead:\the\SimplePMRefs:\Granpa\endcsname{\FOmasterreference}
%     \expandafter\xdef\csname First:\Granpa\endcsname{\FOmasterreference}
%     \expandafter\xdef\csname Blank:\Granpa\endcsname{\FOmasterreference}
%     \expandafter\xdef\csname Odd:\Granpa\endcsname{\FOmasterreference}
%     \expandafter\xdef\csname Even:\Granpa\endcsname{\FOmasterreference}
    \endgroup
    }
   {}

\XMLelement{fo:repeatable-page-master-reference}
   {}
   {\DEBUG{ (multiple pages in \Granpa: use master \FOmasterreference)}
    \begingroup
     \utfeight@protect@chars
%    \expandafter\xdef\csname First:\Granpa\endcsname{\FOmasterreference}
%    \expandafter\xdef\csname Blank:\Granpa\endcsname{\FOmasterreference}
     \expandafter\xdef\csname Odd:\Granpa\endcsname{\FOmasterreference}
%    \expandafter\xdef\csname Even:\Granpa\endcsname{\FOmasterreference}
    \endgroup
   }
   {}


\XMLelement{fo:repeatable-page-master-alternatives}
   {}
   {
    \DEBUG{ (complex page layout with alternatives)}
   }
   {}


\XMLelement{fo:conditional-page-master-reference}
   {}
   {
  \ifx\FOoddoreven\att@even
     \DEBUG{ Even page for \Granpa: \FOmasterreference}
     \begingroup
       \utfeight@protect@chars
       \expandafter\xdef\csname Even:\Granpa\endcsname{\FOmasterreference}
      \endgroup
  \else
    \ifx\FOoddoreven\att@odd
         \DEBUG{ Odd page for \Granpa: \FOmasterreference}
         \begingroup
           \utfeight@protect@chars
           \expandafter\xdef\csname Odd:\Granpa\endcsname{\FOmasterreference}
         \endgroup
    \else
      \ifx\FOpageposition\att@first
         \DEBUG{ First page for \Granpa: \FOmasterreference}
         \begingroup
          \utfeight@protect@chars
          \expandafter\xdef\csname First:\Granpa\endcsname{\FOmasterreference}
         \endgroup
      \else
        \ifx\FOblankornotblank\att@blank
          \DEBUG{ Blank page for \Granpa: \FOmasterreference}
           \begingroup
             \utfeight@protect@chars
             \expandafter\xdef\csname Blank:\Granpa\endcsname{\FOmasterreference}
           \endgroup
        \else
           \DEBUG{ Default page for \Granpa: \FOmasterreference}
           \begingroup
            \utfeight@protect@chars
            \expandafter\xdef\csname Odd:\Granpa\endcsname{\FOmasterreference}
           \endgroup
        \fi
      \fi
    \fi
  \fi
  }
 {}



\XMLelement{fo:simple-page-master}
  {}
  {\let\FOMaster\FOmastername
    \ifx\FOmargin\@empty\relax\else
      \let\FOmarginright\FOmargin
      \let\FOmarginleft\FOmargin
      \let\FOmargintop\FOmargin
      \let\FOmarginbottom\FOmargin
     \fi
    \ifx\FOpagewidth\att@auto\edef\FOpagewidth{\paperwidth}\fi
    \ifx\FOpageheight\att@auto\edef\FOpageheight{\paperheight}\fi
    \expandafter\xdef\csname\FOMaster:after\endcsname{DummyRegion}
    \expandafter\xdef\csname\FOMaster:before\endcsname{DummyRegion}
    \expandafter\xdef\csname\FOMaster:before-extent\endcsname{\FOextent}
    \expandafter\xdef\csname\FOMaster:after-extent\endcsname{\FOextent}
    }
  { 
% \ifdim\InnerTopMargin>\FOmargintop\def\FOmargintop{\InnerTopMargin}\fi
% \ifdim\InnerBottomMargin>\FOmarginbottom\def\FOmarginbottom{\InnerBottomMargin}\fi
% \ifdim\InnerRightMargin>\FOmarginright\def\FOmarginright{\InnerRightMargin}\fi
% \ifdim\InnerLeftMargin>\FOmarginleft\def\FOmarginleft{\InnerLeftMargin}\fi
 \DEBUG{Define page master \FOmargin, \FOMaster, \FOmarginright/\FOmarginleft}
    \begingroup
     \utfeight@protect@chars
    \expandafter\xdef\csname Atomic:\FOMaster\endcsname{
     \MasterTopMargin\FOmargintop\advance\MasterTopMargin\InnerTopMargin\relax
     \MasterBottomMargin\FOmarginbottom\advance\MasterBottomMargin\InnerBottomMargin\relax
     \MasterRightMargin\FOmarginright\advance\MasterRightMargin\InnerRightMargin\relax
     \MasterLeftMargin\FOmarginleft\advance\MasterLeftMargin\InnerLeftMargin\relax
     \paperwidth\FOpagewidth
     \paperheight\FOpageheight
    }
   \endgroup
   }
\endinput

%%% white space hacking to try at some point
\ignorewhitespace
in the code for fo:root
and
\usewhitespace\ignorespaces
(to turn on white space, except for any white space at the start of the
element) at the end of any elements that take character data.

definitions something like'
\def\ignorewhitespace{
 \UnicodeCharacter{13}{ \ignorespaces}
 \UnicodeCharacter{32}{ \ignorespaces}
 \UnicodeCharacter{9}{ \ignorespaces}
}
\def\usewhitespace{
 \UnicodeCharacter{13}{}
 \UnicodeCharacter{32}{}
 \UnicodeCharacter{9}{}
}

