XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition (217 page)

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
5.42Mb size Format: txt, pdf, ePub

   method=“xml”

   indent=“yes”

   encoding=“iso-8859-1”

   cdata-section-elements=“script”

   doctype-system=“booklist.dtd” />

The following example might be used if the output of the stylesheet is a comma-separated-values file using US ASCII characters only:

   method=“text”

   encoding=“us-ascii” />

See Also


on page 280


on page 445

Serialization, Chapter 15

xsl:output-character

The

element allows a character in the result tree to be mapped to a specific string used to represent this character in the serialized output.

Changes in 2.0

The element is new in XSLT 2.0.

Format

   character = char

   string = string />

Position


only appears as a child of the

element.

Attributes

Name
Value
Meaning
character
mandatory
Character
A single XML character; the character that is to be replaced during serialization.
string
mandatory
String
Any string; the string that is to replace the character during serialization.

Content

None. The

element is always empty.

Effect

The

element defines a mapping for a single character within a character map. The way character maps work is described in the entry for the

element on page 280, and in Chapter 15.

The character to be replaced, and the string that is to replace it, must consist entirely of valid XML characters; otherwise, it would not be possible to represent them in the stylesheet. Any special characters must be escaped in the usual way. For example, if you want the ampersand character to be mapped to the string
&ersand;
, write:


See Also


on page 280

Serialization, Chapter 15

xsl:param

The

element is used either at the top level, to describe a global parameter, or immediately within an

or

element, to describe a local parameter to a template or function. It specifies a name for the parameter and a default value, which is used if the caller supplies no value for the parameter.

Changes in 2.0

An
as
attribute has been added to define the required type of the parameter.

A
required
attribute has been added to indicate whether the parameter is mandatory or optional.

A
tunnel
attribute has been added to support the new facility of tunnel parameters.

Format

Different subsets of the format are applicable to stylesheet parameters, template parameters, and function parameters.

Format for Stylesheet Parameters

  name = qname

  select? = expression

  as? = sequence-type

  required? = “yes” | “no”

  


Format for Template Parameters

  name = qname

  select? = expression

  as? = sequence-type

  required? = “yes” | “no”

  tunnel? = “yes” | “no”>

  


Format for Function Parameters

  name = qname

  as? = sequence-type


Position


may appear as a top-level declaration (a child of the

element), or as an immediate child element of

or

. The three kinds of parameters are known as
stylesheet parameters
,
template parameters
, and
function parameters
. In the case of template parameters and function parameters,

elements must come before any other child elements.

Attributes

Name
Value
Meaning
name
mandatory
Lexical QName
The name of the parameter
select
optional
XPath Expression
The default value of the parameter if no explicit value is supplied by the caller
as
optional
Sequence Type
The required type of the parameter value
required
optional
yes
or
no
Indicates whether the parameter is optional or mandatory
tunnel
optional
yes
or
no
Indicates whether the parameter is a tunnel parameter

Other books

They Call Me Creature by R.L. Stine
Mystique by Ann Cristy
The Gallipoli Letter by Keith Murdoch
Love's Pursuit by Siri Mitchell
Sweat by Zora Neale Hurston
The Runaways by Elizabeth Goudge
Idea in Stone by Hamish Macdonald
TRAPPED by ROSE, JACQUI
Chocolate-Covered Crime by Hickey, Cynthia
The Sage by Christopher Stasheff