5.2 Graphics and foreign objects

5.2.1 Non-textual information

Graphic and other non-textual constructs can come from two possible sources.

  • External files:

    • are referenced by external-graphic ,

    • use URIs to specify how to obtain the external resource.

  • Embedded non-XSL-FO-namespace constructs:

    • are referenced by instream-foreign-object ,

    • will not be confused with XSL-FO objects because of namespace distinction,

    • may include Scalable Vector Graphics (SVG), Math Markup Language (MathML), etc.,

    • promote the generation of images from the stylesheets that generate the XSL-FO;

      • e.g., numbers can be charted using SVG constructs from the XML instance.

XSL-FO processor need not recognize the formats, only pass on the content from whatever source to rendering agent for imaging.

  • The formatter is only responsible for measuring and allocating the required area on the page as indicated by the properties.

  • Rendering agent must recognize the file type by either name or content.

    • No notation information is communicated through the stylesheet from the DTD.

Content need not be a static graphic image;

  • it could be a window into an application user interface, e.g.:

    • a spreadsheet.

The src property has specific syntactic requirements.

  • It is safest to use url(" uri-value-here ") .

    • The author of the XML document may be creating the URI being used in the resulting syntax.

    • The URI character set includes the single quote that would bring about an improperly formed attribute value if the single quote is used as the delimiter .

  • You could use no quote delimiters, unless the URI contains a single quote.

  • You could use single quote delimiters, unless the URI contains a single quote.

  • Make sure the XML syntax for attribute quotes is acceptable, e.g.:

    • src='url(" uri-value-here ")' ,

    • src="url(" uri-value-here ")" .

  • This is not a function call, but a syntactic convention.

    • Without it, the URI syntax could be misinterpreted as expression syntax.

    • Without it, any embedded single quotes (which are allowed in URI syntax and could be in the source XML without the stylesheet writer knowing) could confuse the interpretation of the literal string.

5.2.2 The external-graphic object

Purpose
  • This is the inline-level display of graphical or other externally-supplied information.

    • Displayed matter is not part of the XSL-FO instance content;

      • it is a reference to an addressed external resource.

    • It can be placed in a block object for block-level display.

Content
  • ( 6.6.5 ) EMPTY .

Property sets
  • Common accessibility properties ( 7.4 ; 326),

  • common aural properties ( 7.6 ; 327),

  • common border, padding, and background properties ( 7.7 ; 328),

  • common margin properties inline ( 7.11 ; 333),

  • common relative position properties ( 7.12 ; 333).

Other required property
  • src ( 7.28.7 ; 417).

Other optional properties
  • alignment-adjust ( 7.13.1 ; 346),

  • alignment-baseline ( 7.13.2 ; 346),

  • baseline-shift ( 7.13.3 ; 351),

  • block-progression-dimension ( 7.14.1 ; 352),

  • clip ( 7.20.1 ; 368),

  • content-height ( 7.14.2 ; 370),

  • content-type ( 7.28.1 ; 371),

  • content-width ( 7.14.3 ; 371),

  • display-align ( 7.13.4 ; 373),

  • dominant-baseline ( 7.13.5 ; 374),

  • height ( 7.14.4 ; 382),

  • id ( 7.28.2 ; 384),

  • inline-progression-dimension ( 7.14.5 ; 385),

  • keep-with- next ( 7.19.4 ; 386),

  • keep-with-previous ( 7.19.5 ; 387),

  • line-height ( 7.15.4 ; 390),

  • overflow ( 7.20.2 ; 397),

  • scaling ( 7.14.10 ; 411),

  • scaling-method ( 7.14.11 ; 412),

  • text-align ( 7.15.9 ; 421),

  • width ( 7.14.12 ; 428).

Shorthands influencing the above properties
  • font ( 7.29.13 ; 377),

  • page-break-after ( 7.29.16 ; 401),

  • page-break-before ( 7.29.17 ; 401),

  • vertical-align ( 7.29.22 ; 424).

Property of interest
  • text-align and display-align are used to align the scaled image's reference area within the viewport area;

    • ancestral specifications will align the viewport area within its parent area.

An excerpt from Figure 5-2 is shown in Example 5-5.

Example 5-5 An example of referencing an external resource
 Line 01 <block font-size="24pt" space-after="16pt" space-before="1cm"       02        text-align="center">      03        Table    of    Contents      04        <block/>      05        <external-graphic src='url(&quot;smflags.bmp&quot;)'/>      06 </block> 

Note the following regarding the structure of this example.

  • By default, white space is collapsed so that the words "Table of Contents" are flowed on the page as if separated by only one space each.

  • An empty block is used to introduce a line of zero size thus breaking the title and the graphic onto separate lines.

  • The protected quoted syntax is used for the URI of the graphic image.

  • All inline constructs on all lines of the outside block are centered using text-align .

5.2.3 The instream-foreign-object object

Purpose
  • This is the inline display of graphical or other instance-supplied information.

    • Displayed matter is a part of the XSL-FO instance content.

      • Descendent content of the object uses a non-XSL-FO namespace.

    • The object can be placed in a block object for block-level display.

Content (6.6.6)
  • a single child element from a non-XSL-FO namespace.

Property sets
  • Common accessibility properties ( 7.4 ; 326),

  • common aural properties ( 7.6 ; 327),

  • common border, padding, and background properties ( 7.7 ; 328),

  • common margin properties inline ( 7.11 ; 333),

  • common relative position properties ( 7.12 ; 333).

Other optional properties
  • alignment-adjust ( 7.13.1 ; 346),

  • alignment-baseline ( 7.13.2 ; 346),

  • baseline-shift ( 7.13.3 ; 351),

  • block-progression-dimension ( 7.14.1 ; 352),

  • clip ( 7.20.1 ; 368),

  • content-height ( 7.14.2 ; 370),

  • content-type ( 7.28.1 ; 371),

  • content-width ( 7.14.3 ; 371),

  • display-align ( 7.13.4 ; 373),

  • dominant-baseline ( 7.13.5 ; 374),

  • height ( 7.14.4 ; 382),

  • id ( 7.28.2 ; 384),

  • inline-progression-dimension ( 7.14.5 ; 385),

  • keep-with-next ( 7.19.4 ; 386),

  • keep-with-previous ( 7.19.5 ; 387),

  • line-height ( 7.15.4 ; 390),

  • overflow ( 7.20.2 ; 397),

  • scaling ( 7.14.10 ; 411),

  • scaling-method ( 7.14.11 ; 412),

  • text-align ( 7.15.9 ; 421),

  • width ( 7.14.12 ; 428).

Shorthands influencing the above properties
  • font ( 7.29.13 ; 377),

  • page-break-after ( 7.29.16 ; 401),

  • page-break-before ( 7.29.17 ; 401),

  • vertical-align ( 7.29.22 ; 424).

Property of interest
  • text-align and display-align are used to align the scaled image's reference area within the viewport area;

    • ancestral specifications will align the viewport area within its parent area.

Example 5-6 shows embedding alternate namespace content (in this case, Scalable Vector Graphics, SVG) into an XSL-FO instance.

Example 5-6 Embedding of SVG into XSL-FO
 Line 01 <block text-align="center">      02   <block>      03  <instream-foreign-object>  04       <svg:svg xmlns:svg="http://www.w3.org/2000/svg"      05                width="170" height="145">      06         <svg:g style="stroke:black; fill:black">      07           <svg:polygon points="  5, 50,  5, 81, 12, 64"/>      08           <svg:polygon points="  5, 45, 41,116, 41, 73"/>      09           <svg:polygon points=" 44, 76, 44,119, 61,115"/>      10           <svg:polygon points=" 46, 73, 75,140,105, 73"/>      11           <svg:polygon points="107, 76,107,119, 89,115"/>      12           <svg:polygon points="144, 45,110,116,110, 74"/>      13           <svg:polygon points="145, 41,167,  4,109, 71"/>      14           <svg:polygon points=" 66, 70, 75, 63, 84, 70"/>       15         </svg:g>      16       </svg:svg>      17  </instream-foreign-object>  18   </block>      19   <block font-size="20pt" font-weight="bold">Crane Logo</block>      20 </block> 

The rendering of the embedded image is shown in Figure 5-9.

Figure 5-9. An embedded SVG image

graphics/05fig09.jpg



Definitive XSL-FO
Definitive XSL-FO
ISBN: 0131403745
EAN: 2147483647
Year: 2002
Pages: 99
Authors: G. Ken Holman

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net