Table of contents

Abstract

Introduction

The basic concepts

Stylesheet organization

Root template

Match processing instruction nodes

Match text nodes

Match attributes

Match other nodes

Keepspace template

Using the stylesheet

The complete stylesheet

Keepspace template

The keepspace template implements a standard identity transform that recursively copies all attributes and nodes, while ignoring whitespace in text nodes.

<xsl:template match="@*|node()" mode="keepspace">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()" mode="keepspace"/>
    </xsl:copy>
</xsl:template>

This template makes the assumption that elements preserving space do not contain processing instructions. If necessary, you could create templates similar to the processing instruction template that used the keepspace mode.

 

 

 

Next Page:
Using the stylesheet


Scriptorium Publishing | Post Office Box 12761 Research Triangle Park, NC 27709 | (919) 481 2701 | info@scriptorium.com