Neutral objects

Some features may be employed both in-line and at the block level. These include the ability to swap-in and swap-out portions of the document dynamically, change the style of an object dynamically, and apply inherited styles to a range of items.

Switches

When publishing electronically, it is possible to hide and reveal portions of the document depending on user actions. The opening and collapsing of portions of a contents list can be supported using such a feature. The Multi Switch element contains a number of Multi Case elements. Each of these elements holds an alternative document fragment, and each alternative must be given a unique name, so that it can be referred to and activated later. The Case Name attribute holds this value:

						<multi-switch>
						<multi-case case-name="first">...</multi-case>
  <multi-case case-name="second">...</multi-case>
  <multi-case case-name="third">...</multi-case>
</multi-switch>
					

Only one of these fragments is active when the page is initially presented to the user. The content of the first Multi Case element with a Starting State attribute value of 'show' (instead of the default value of 'hide') is presented first. The others can be revealed later:

<multi-case case-name="first">...</multi-case>
<multi-case case-name="second" starting-state="show">
  <block>THIS PORTION IS SHOWN FIRST</block>
</multi-case>

Within each document fragment, there may be any number of Multi Toggle elements, which are used to switch-in one of the other fragments. The text contained in these elements becomes 'hot' text that the user can select. When selected by the user, the associated case fragment replaces the current fragment. The Switch To attribute refers to the name of the fragment to swap in (the Case Name attribute of the relevant Multi Case element):

<multi-case case-name="closed" starting-state="show">
  <block>Heading
    <multi-toggle
						switch-to="opened" >
      [+]
						</multi-toggle>
  </block>
</multi-case>
<multi-case case-name="opened">
  <block>Heading
    <multi-toggle switch-to="closed" >
      [-]
    </multi-toggle>
  </block>
  <block>- Item 1</block>
  <block>- Item 2</block>
</multi-case>

When multiple cases are embedded within other multiple cases, the user may change the selected case of the embedded case, then change the outer one, but later return to it. The question that then arises is whether the default case is shown for the inner multiple or the one that was last selected (ie does the browser 'remember' the previous state). The Auto Restore attribute can be added to the Multi Switch element. It takes a value of 'yes' or 'no' (the default). If set to 'yes', this attribute states that the default should be restored. Otherwise, the last one selected is restored instead.

Changing styles

The style of a range of blocks, or range of text, can be changed, depending on the current state of the environment. An example given in the XSL standard refers to the way that the colour of a hypertext link source may vary, depending on whether the link has been visited recently or is currently selected. The Multi Properties element contains a number of initial, empty Multi Property Set elements, each one providing the style to apply under a given circumstance, identified using the Dom State attribute. These elements are followed by the document fragment to be styled:

						<multi-properties>
<multi-property-set dom-state="visited"
                    color="#FF0000" />
<multi-property-set dom-state="active"
                    color="#00FF00" />
<multi-property-set dom-state="inactive"
                    color="#0000FF" />
The colour of this text depends on the current state.
</multi-properties>
					

Only style changes that do not affect the placement of the text in the page should be included, as support for re-flowing the text may not be present in some systems, or may be an undesirable side-effect in any case.

The Dom State attribute refers to the DOM (Document Object Model), which is an in-memory tree-like representation of an XML document. DOM states, such as 'mouse-over', may be supported by the XSL formatter, but only if it is still active as the user is reading the document. Possible DOM states are not listed in the draft XSL standard and are yet to be determined.

Visibility

Block and in-line objects are normally 'visible', as specified in the Visibility attribute. These objects can be rendered invisible by setting this attribute value to 'hidden'. The objects then still exist, and still occupy the same amount of space they would normally do, but their contents are not presented. One reason to do this is to achieve unusual spacing effects. Another reason would be to add further interactive features, with software changing the value between 'visible' and 'hidden' as appropriate.

In a table, a cell that is set to 'hidden', when the Empty Cells attribute is also set to 'hide', will have no border lines (assuming separate border lines for each cell).

A third option is 'collapse'. In the circumstances above, this value is equivalent to 'hidden', but in table rows and columns it has a different effect. Unfortunately, the draft standard is not clear on what this difference is.

Wrappers

Sometimes, it is useful to be able to specify a style that is to be applied to a sequence of characters without creating an enclosing object. Although the Inline element can be used to specify character styles (which the characters inherit), it creates an inline object as well. The styles specified in an Inline element are actually applied to the inline object, and then inherited by embedded Character elements (which are implied when characters are entered directly). The Inline element is necessary when the intent is to add a border around the text, as the border is actually placed around the inline object created by this instruction. But when the intent is only to apply individual styles to each of the embedded characters, the Wrapper element is preferable. This element does not create an object on the page, but is simply used as a convenient 'wrapper' with inheritable properties:

<block>A <wrapper font-weight="bold">bold</wrapper>
word.</block>

This element can also be employed around block elements:

<wrapper margin-left="2cm">
  <block>...</block>
  <block>...</block>
  <block>...</block>
</wrapper>

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset