[Accessibility conventions are described at the bottom of the page]
*** This is a free preview excerpt of a commercial publication. ***

B. XSL-FO expressions
[> C.][< A.2.1][^^^]
B.0 Expressions in XSL-FO
[> B.1][> C.][< B.][^^][^^^]
This annex first summarizes in production order all of the productions in the expression grammar in the Recommendation:
[[1] - the left-hand side is the production being defined
 [1] - the right-hand side is the definition of the grammatical construct
]
Secondly, this annex summarizes the built-in functions available in the XSL-FO processor.
B.1 XSL-FO expressions
[> B.2][< B.0][^^][^^^]
B.1.1 Production summary
[> B.2][> C.][< B.0][^^][^^^]
[1] Expr
::=
[AdditiveExpr][11]
[2] PrimaryExpr
::=
'(' [Expr][1] ')'
| [Numeric][5]
| [Literal][20]
| [Color][18]
| [Keyword][24]
| [EnumerationToken][26]
| [FunctionCall][3]
[3] FunctionCall
::=
[FunctionName][25] '(' ( [Argument][4] ( ',' [Argument][4])*)? ')'
[4] Argument
::=
[Expr][1]
[5] Numeric
::=
[AbsoluteNumeric][6]
| [RelativeNumeric][8]
[6] AbsoluteNumeric
::=
[AbsoluteLength][7]
[7] AbsoluteLength
::=
[Number][15] [AbsoluteUnitName][27]?
[8] RelativeNumeric
::=
[Percent][9]
| [RelativeLength][10]
[9] Percent
::=
[Number][15] '%'
[10] RelativeLength
::=
[Number][15] [RelativeUnitName][27]
[11] AdditiveExpr
::=
[MultiplicativeExpr][12]
| [AdditiveExpr][11] '+' [MultiplicativeExpr][12]
| [AdditiveExpr][11] '-' [MultiplicativeExpr][12]
[12] MultiplicativeExpr
::=
[UnaryExpr][13]
| [MultiplicativeExpr][12] [MultiplyOperator][23] [UnaryExpr][13]
| [MultiplicativeExpr][12] 'div' [UnaryExpr][13]
| [MultiplicativeExpr][12] 'mod' [UnaryExpr][13]
[13] UnaryExpr
::=
[PrimaryExpr][2]
| '-' [UnaryExpr][13]
[14] ExprToken
::=
'(' | ')' | '%'
| [Operator][21]
| [FunctionName][25]
| [EnumerationToken][26]
| [Number][15]
[15] Number
::=
[FloatingPointNumber][16]
[16] FloatingPointNumber
::=
[Digits][17] ('.' [Digits][17]?)?
| '.' [Digits][17]
[17] Digits
::=
[0-9]+
[18] Color
::=
'#' [AlphaOrDigits][19]
[19] AlphaOrDigits
::=
[a-fA-F0-9]+
[20] Literal
::=
'"' [^"]* '"'
| "'" [^']* "'"
[21] Operator
::=
[OperatorName][22]
| [MultiplyOperator][23]
| '+' | '-'
[22] OperatorName
::=
'mod' | 'div'
[23] MultiplyOperator
::=
'*'
[24] Keyword
::=
'inherit'
[25] FunctionName
::=
NCName[(XML Namespaces)]
[26] EnumerationToken
::=
NCName[(XML Namespaces)]
[27] AbsoluteUnitName
::=
'cm' | 'mm' | 'in' | 'pt' | 'pc' | 'px'
[28] RelativeUnitName
::=
'em'
[29] ExprWhitespace
::=
S[(XML)]
B.2 XSL-FO functions
[> C.][< B.1.1][^^][^^^]
B.2.1 Function summary
[> B.2.2][> C.][< B.1.1][^^][^^^]
Expressions can incorporate numbers and lengths as operands
[[1] - a number does not include a unit of measure
[[2] - termed "a unit power of zero"
][1] - a length does include a unit of measure (inches, mm, etc.)
[[2] - termed "a unit power of one"
]]
Performing numeric operations on lengths
[[1] - some functions accept either lengths or numbers as operands
[[2] - e.g. font-size="min(10pt,1em)"
 [2] - e.g. <table-cell column-number="min(3,5)">
 [2] - sometimes (as in min()) both operands must have the same unit power
][1] - some functions do not work on lengths, only numbers
[[2] - e.g. round() accepts only numbers, not lengths
[[3] - to round a length: convert length to a number, round, then convert result to a length
 [3] - e.g. round(.75in div 1in)*1in
]]]
Percentages are counted in 1/100 units
[[1] - can be utilized in a property as a relation to the property's current value
[[2] - the following expressions all evaluate to the same value:
[[3] - font-size="150%"
 [3] - font-size="1.5 * inherited-property-value(font-size)"
 [3] - font-size="1.5em"
]]]
B.2.2 Function groupings
[> B.2.3][> C.][< B.2.1][^][^^][^^^]
Color Functions (5.10.2)
[[1] - [rgb()]
 [1] - [rgb-icc()]
 [1] - [system-color()]
]
Font Functions (5.10.3)
[[1] - [system-font()]
]
Number Functions (5.10.1)
[[1] - [abs()]
 [1] - [ceiling()]
 [1] - [floor()]
 [1] - [max()]
 [1] - [min()]
 [1] - [round()]
]
Property Value Functions (5.10.4)
[[1] - [body-start()]
 [1] - [from-nearest-specified-value()]
 [1] - [from-page-master-region()]
 [1] - [from-parent()]
 [1] - [from-table-column()]
 [1] - [inherited-property-value()]
 [1] - [label-end()]
 [1] - [merge-property-values()]
 [1] - [proportional-column-width()]
]
B.2.3 Functions summarized by name
[> C.][< B.2.2][^][^^][^^^]
numeric abs(numeric) (5.10.1)
[[1] - returns absolute value of number or length argument
]
numeric body-start() (5.10.4)
[[1] - returns the start indent corresponding to the list-item body when considering the provisional-valued properties of the list
]
numeric ceiling(numeric) (5.10.1)
[[1] - returns number closest to positive infinity
]
numeric floor(numeric) (5.10.1)
[[1] - returns number closest to negative infinity
]
object from-nearest-specified-value(NCName) (5.10.4)
[[1] - returns the value of the named property from the nearest ancestor of the formatting object in which the property value is being explicitly specified
 [1] - returns the initial value if there is no parent
]
object from-page-master-region(NCName) (5.10.4)
[[1] - signals for each region created for a page sequence that the property's value is obtained from the named property of the region's definition, or if no name is supplied, the property being assigned
 [1] - until used differently in some future specification, XSL-FO 1.1 restricts this only to the two properties [writeing-mode]= and [reference-orientation]=, and in both cases a named property is not allowed to be specified
]
object from-parent(NCName) (5.10.4)
[[1] - returns the value of the named property from the parent of the formatting object of the property being evaluated
 [1] - returns the initial value if there is no parent
]
object from-table-column(NCName) (5.10.4)
[[1] - returns the value of the named property from the <[table-column]> corresponding to the current column in the table
]
object inherited-property-value(NCName) (5.10.4)
[[1] - returns the value of the inherited property named
 [1] - it is an error if the property named is not an inherited property
]
numeric label-end() (5.10.4)
[[1] - returns the end indent corresponding to the list-item label when considering the provisional-valued properties of the list
]
numeric max(numeric, numeric) (5.10.1)
[[1] - returns the minimum of two arguments
 [1] - arguments may be either lengths or numbers but must be the same type
]
object merge-property-values(NCName) (5.10.4)
[[1] - returns the property calculated from the property set corresponding to the current user-agent state within the parent's child property sets
]
numeric min(numeric, numeric) (5.10.1)
[[1] - returns the minimum of two arguments
 [1] - arguments may be either lengths or numbers but must be the same type
]
numeric proportional-column-width(numeric) (5.10.4)
[[1] - returns the length corresponding to the number of units of proportional measure of the current table column's table as indicated in the supplied argument
 [1] - note that proportional measure is that length left over when removing specified column widths from the table width and dividing the result by the number of columns for which widths are not specified
]
color rgb(numeric, numeric, numeric) (5.10.2)
[[1] - returns a color from the RGB space
 [1] - arguments must be numbers, not lengths
]
color rgb-icc(numeric, numeric, numeric, NCName, numeric, numeric) (5.10.2)
[[1] - returns a color from the named ICC color profile
 [1] - the first three arguments are the fallback RGB color if the ICC color is not found
 [1] - the last arguments are specific to the color profile
]
numeric round(numeric) (5.10.1)
[[1] - returns whole number closest to given number
 [1] - returns ceiling() on the value .5
]
color system-color(NCName) (5.10.2)
[[1] - returns the system-defined color named in the argument
]
object system-font(NCName, NCName) (5.10.3)
[[1] - returns the font-size characteristic named in the second argument of the system font named in the first argument
 [1] - if the second argument is omitted, the characteristic is that which is being assigned by the expression
]

*** This is a free preview excerpt of a commercial publication. ***

This is an accessible version of Crane's commercial training material. The content has been specifically designed to assist screen reader software in viewing the entire textual content. Figures are replaced with text narratives.

Navigation hints are in square brackets:
[Tx.x] and [Fx.x] are textual representations of the applicability icons;
[digit] indicates list depth for nested lists;
[link [URL]] indicates the URL of a hyperlink if different than link;
[EXAMPLE] indicates an example listing of code;
[FIGURE] indicates the presence of a figure replaced by its description;
[>] jumps forward;
[<] jumps backward;
[^] jumps to start of the section;
[^^] jumps to the start of the chapter;
[^^^] jumps to the table of contents.
Suggestions for improvement are welcome: [info@CraneSoftwrights.com]
Book sales: [http://www.CraneSoftwrights.com/links/trn-acc.htm]
Information: [http://www.CraneSoftwrights.com/links/info-acc.htm]
This content is protected by copyright and, as there are no means to protect this accessible version from plagiarism, please do not make any commercial edition available to others.

+//ISBN 978-1-894049::CSL::Courses::PFUX//DOCUMENT Practical Formatting Using XSL-FO 2008-01-27 17:30UTC//EN
Practical Formatting Using XSL-FO
Seventh Edition - 2008-01-27
ISBN 978-1-894049-19-1
Copyright © Crane Softwrights Ltd.