Tab Extensions

Top Previous Topic Next Topic  Print this topic

This section describes extensions used to set the tab value needed while working with a document.

In the example below it can be seen the way it can be used:

 

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"

       xmlns:xf="http://www.ecrion.com/xf/1.0" > (1)

<xf:defaultTabStop val="2in"/> (2)

 <fo:layout-master-set>

       <fo:simple-page-master master-name="all-pages"

               page-width="8.5in" page-height="3in">

               <fo:region-body region-name="xsl-region-body"

               margin="0.7in" column-gap="0.25in" padding="6pt"/>

               <fo:region-before region-name="xsl-region-before"

       extent="0.7in" display-align="after" padding="6pt 0.7in" />

               <fo:region-after region-name="xsl-region-after" extent="0.7in"

               display-align="before" padding="6pt 0.7in" />

       </fo:simple-page-master>

       <fo:page-sequence-master master-name="default-sequence">

               <fo:repeatable-page-master-reference

                                master-reference="all-pages" />

       </fo:page-sequence-master>

 </fo:layout-master-set>

 <fo:page-sequence master-reference="default-sequence">

       <fo:static-content flow-name="xsl-region-before"

                       font-family="Times New Roman" font-size="12pt">

               <fo:block>&#x00A0;</fo:block>

       </fo:static-content>

       <fo:static-content flow-name="xsl-region-after"

                       font-family="Times New Roman" font-size="12pt">

               <fo:block>&#x00A0;</fo:block>

       </fo:static-content>

       <fo:flow flow-name="xsl-region-body"

                       font-family="Times New Roman" font-size="12pt">

               <fo:block font-size="14" color="red">

               <xf:tabstops> (3)

                       <xf:tabstop pos="1in"></xf:tabstop> (4)

                       <xf:tabstop pos="3in"></xf:tabstop>

                       <xf:tabstop pos="4in"></xf:tabstop>

               </xf:tabstops>

               t<xf:tab/>o<xf:tab/>t<xf:tab/>o</fo:block> (5)

               <fo:block text-decoration="underline" font-size="14"        

                                                       color="blue">        

               <xf:tabstops>

                       <xf:tabstop pos="96px"></xf:tabstop>

                       <xf:tabstop pos="2in"></xf:tabstop>

                       <xf:tabstop pos="5in"></xf:tabstop>

               </xf:tabstops>

               t<xf:tab/>o<xf:tab/>t<xf:tab/>o</fo:block>        

               <fo:block font-size="14" color="green">        

               t<xf:tab/>o<xf:tab/>t<xf:tab/>o</fo:block>                        

       </fo:flow>

 </fo:page-sequence>

</fo:root>

 

Things to notice in this example:

 

(1) In order to work with extension you must have the corresponding xml namespace defined.

(2) xf:defaultTabStop defines working with tabs; val="2in" set the default tab value.

(3) xf:tabstops overrides the default tab values for the fo:block where is defined.

(4) xf:tabstop is used to set the new tab values using the pos attribute; its value can be introduced in pixels or inch; that means that every time you use tab the cursor jumps to the defined values for pos.

(5) xf:tab is the extension used to insert the tab in the fo:block.