Common » Utility Template Reference
$Id: utility.xsl 7101 2007-07-20 15:32:12Z xmldoc $
IntroductionThis is technical reference documentation for the
miscellaneous utility templates in the DocBook XSL
Stylesheets.These templates are defined in a separate file from the set
of “common” templates because some of the common templates
reference DocBook XSL stylesheet parameters, requiring the
entire set of parameters to be imported/included in any
stylesheet that imports/includes the common templates.The utility templates don’t import or include any DocBook
XSL stylesheet parameters, so the utility templates can be used
without importing the whole set of parameters.This is not intended to be user documentation. It is
provided for developers writing customization layers for the
stylesheets.Logs/emits formatted notes and warningsThe log.message template is a utility
template for logging/emitting formatted messages – that is,
notes and warnings, along with a given log “level” and an
identifier for the “source” that the message relates to.levelText to log/emit in the message-level field to
indicate the message level
(Note or
Warning)sourceText to log/emit in the source field to identify the
“source” to which the notification/warning relates.
This can be any arbitrary string, but because the
message lacks line and column numbers to identify the
exact part of the source document to which it
relates, the intention is that the value you pass
into the source parameter should
give the user some way to identify the portion of
their source document on which to take potentially
take action in response to the log message (for
example, to edit, change, or add content).So the source value should be,
for example, an ID, book/chapter/article title, title
of some formal object, or even a string giving an
XPath expression.context-descText to log/emit in the context-description field to
describe the context for the message.context-desc-field-lengthSpecifies length of the context-description field
(in characters); default is 12If the text specified by the
context-desc parameter is longer
than the number of characters specified in
context-desc-field-length, it is
truncated to context-desc-field-length
(12 characters by default).If the specified text is shorter than
context-desc-field-length,
it is right-padded out to
context-desc-field-length (12 by
default).If no value has been specified for the
context-desc parameter, the field is
left empty and the text of the log message begins with
the value of the message
parameter.messageText to log/emit in the actual message fieldmessage-field-lengthSpecifies length of the message
field (in characters); default is 45Outputs a message (generally, to standard error).12rightright: : Gets a title from the current documentThe get.doc.title template is a
utility template for returning the first title found in the
current document.Returns a string containing some identifying title for the
current document .Right-pads or left-pads a string out to a certain lengthThis function takes string padVar and
pads it out in the direction rightLeft to
the string-length length, using string
padChar (a space character by default) as
the padding string (note that padChar can
be a string; it is not limited to just being a single
character).This function began as a copy of Nate Austin's
prepend-pad function in the Padding
Content section of Dave Pawson's XSLT
FAQ.Returns a (padded) string.left