Query Nodes

If you want to generate e.g. a table-of-contents   you have to query all <TITLE>-Elements.
This example shows   how to query the <TITLE>-Elements.

(select-elements ndl pattern)

Returns all nodes matching pattern. In the example all considered elements are emphasized in a red color.

(descendants ndl)

Returns recursive all children of ndl: The children of ndl, the children of the children of ndl, ... .

Example

This example should query all TITLE-Elements, e.g. to generate a table of contents.

Problem: The method (select-elements ndl pattern) selects just elements in the node-list ndl.
The children of ndl are not considered, but all TITLE-Elements should be queried.

Solution: The method descendants is used instead of children.

You need a java-enabled browser!!!

Stylesheets

A table-of-contents is generated by selecting the TITLE elements of the SGML-document.

Problem

The formatting of the titles is not suitable for the table-of-contents. The font-size is for instance too big.

Solution

Use a special mode for formatting titles in a table-of-contents.

The use of modes is explained in the other DSSSL-tutorials.


Next: Attributes
Index