XML Markup Templates

Steve Ball

$Id: markup.html,v 1.4 2004/10/10 06:18:57 balls Exp $


Introduction

This stylesheet module provides functions for generating literal XML markup.

Table of Contents

markup:xml-declaration - Create an XML Declaration
markup:doctype-declaration - Create a Document Type Declaration
markup:element-declaration - Create an Element Declaration
markup:attlist-declaration - Create an Attribute List Declaration
markup:attribute-definition - Create an Attribute Definition
markup:entity-declaration - Create an Entity Declaration
markup:quote-value - Quote an Attribute Value
markup:external-identifier - Create an External Identifier
markup:entity-reference - Create an Entity Reference
markup:notation-declaration - Create a Notation Declaration
markup:cdata-section - Create a CDATA Section
markup:as-xml - Format Nodeset As XML Markup

Name

markup:xml-declaration — Create an XML Declaration

Synopsis

<xsl:template name="markup:xml-declaration"><xsl:param name="version" select="'1.0'"/><xsl:param name="standalone"/><xsl:param name="encoding"/>  ...</xsl:template>

This template returns an XML Declaration. Although the XSLT standard provides control over the generation of the XML Declaration, this template may be useful in circumstances where the values must be computed at runtime.

Parameters
version

Version number.

standalone

Standalone indication. Must be value "yes" or "no".

encoding

Character encoding.

Returns

Returns an XML Declaration as a string.



Name

markup:doctype-declaration — Create a Document Type Declaration

Synopsis

<xsl:template name="markup:doctype-declaration"><xsl:param name="docel"/><xsl:param name="publicid"/><xsl:param name="systemid"/><xsl:param name="internaldtd"/>  ...</xsl:template>

This template returns a Document Type Declaration. Although the XSLT standard provides control over the generation of a Document Type Declaration, this template may be useful in circumstances where the values for the identifiers or the internal subset must be computed at runtime.

Parameters
docel

The name of the document element.

publicid

The public identifier for the external DTD subset.

systemid

The system identifier for the external DTD subset.

internaldtd

The internal DTD subset.

Returns

Returns a Document Type Declaration as a string.



Name

markup:element-declaration — Create an Element Declaration

Synopsis

<xsl:template name="markup:element-declaration"><xsl:param name="type"/><xsl:param name="content-spec" select="'ANY'"/>  ...</xsl:template>

This template returns an element declaration..

Parameters
type

The element type.

content-spec

The content specification.

Returns

Returns an element declaration as a string.



Name

markup:attlist-declaration — Create an Attribute List Declaration

Synopsis

<xsl:template name="markup:attlist-declaration"><xsl:param name="type"/><xsl:param name="attr-defns"/>  ...</xsl:template>

This template returns an attribute list declaration.

Parameters
type

The element type.

attr-defns

Attribute definitions.

Returns

Returns an attribute list declaration as a string.



Name

markup:attribute-definition — Create an Attribute Definition

Synopsis

<xsl:template name="markup:attribute-definition"><xsl:param name="name"/><xsl:param name="type"/><xsl:param name="default"/>  ...</xsl:template>

This template returns an attribute definition.

Parameters
name

The attribute name.

type

The attribute type.

default

The attribute default.

Returns

Returns an attribute definition as a string.



Name

markup:entity-declaration — Create an Entity Declaration

Synopsis

<xsl:template name="markup:entity-declaration"><xsl:param name="name"/><xsl:param name="parameter" select="false()"/><xsl:param name="text"/><xsl:param name="nodes"/><xsl:param name="publicid"/><xsl:param name="systemid"/><xsl:param name="notation"/>  ...</xsl:template>

This template returns an entity declaration.

If the 'text' parameter is given a value, then an internal entity is created. If either the 'publicid' or 'systemid' parameters are given a value then an external entity is created. It is an error for the 'text' parameter to have value as well as the 'publicid', 'systemid' or 'notation' parameters.

Parameters
name

The entity name.

parameter

Boolean value to determine whether a parameter entity is created. Default is 'false()'.

text

The replacement text. Must be a string.

nodes

The replacement text as a nodeset. The nodeset is formatted as XML using the as-xml template. If both text and nodes are specified then nodes takes precedence.

publicid

The public identifier for an external entity.

systemid

The system identifier for an external entity.

notation

The notation for an external entity.

Returns

Returns an entity declaration as a string.



Name

markup:quote-value — Quote an Attribute Value

Synopsis

<xsl:template name="markup:quote-value"><xsl:param name="value"/>  ...</xsl:template>

This template returns a quoted value.

Parameters
value

The value to quote.

Returns

Returns a quote value as a string.



Name

markup:external-identifier — Create an External Identifier

Synopsis

<xsl:template name="markup:external-identifier"><xsl:param name="publicid"/><xsl:param name="systemid"/><xsl:param name="leading-space" select="false()"/>  ...</xsl:template>

This template returns an external identifier.

Parameters
publicid

The public identifier.

systemid

The system identifier.

Returns

Returns an external identifier as a string.



Name

markup:entity-reference — Create an Entity Reference

Synopsis

<xsl:template name="markup:entity-reference"><xsl:param name="name"/>  ...</xsl:template>

This template returns an entity reference.

Parameters
name

The name of the entity.

Returns

Returns an entity reference as a string.



Name

markup:notation-declaration — Create a Notation Declaration

Synopsis

<xsl:template name="markup:notation-declaration"><xsl:param name="name"/><xsl:param name="publicid"/><xsl:param name="systemid"/>  ...</xsl:template>

This template returns a notation declaration.

Parameters
name

The notation name.

publicid

The public identifier for the notation.

systemid

The system identifier for the notation.

Returns

Returns a notation declaration as a string.



Name

markup:cdata-section — Create a CDATA Section

Synopsis

<xsl:template name="markup:cdata-section"><xsl:param name="text"/>  ...</xsl:template>

This template returns a CDATA Section. The XSLT specification provides a mechanism for instructing the XSL processor to output character data in a CDATA section for certain elements, but this template may be useful in those circumstances where not all instances of an element are to have their content placed in a CDATA section.

Parameters
text

The content of the CDATA section.

Returns

Returns a CDATA section as a string.



Name

markup:as-xml — Format Nodeset As XML Markup

Synopsis

<xsl:template name="markup:as-xml"><xsl:param name="nodes"/>  ...</xsl:template>

This template returns XML markup. Each node in the given nodeset is converted to its equivalent XML markup.

BUG: This version may not adequately handle XML Namespaces.

Parameters
nodes

Nodeset to format as XML.

Returns

Returns XML markup.