To query a value in a
context by means of an NPSOBJ instruction,
one needs to specify the name of the value. In the simplest case this
is a simple name (simple_name
) such as title
or lastChanged
:
<npsobj insertvalue="var" name="title" />
In such a case the returned value is a string. For other names (such as
parent
), however, the returned value is a file. If one inserts
this type of value directly into the output produced for the exported file,
one gets a string representation of the file, which is generally not the
desired result. It is therefore possible to ask this file in turn for a
value. This can be done by appending the name of this value to the first
name, separated by a dot. This way, several names can be combined to form a
query that consists of more than one component:
<npsobj insertvalue="var" name="parent.title" /><br /> <npsobj insertvalue="var" name="parent.next.title" />
A name has the following structure:
composite_name ::= [ exporter_prefix_sequence ] [ simple_name_sequence ] exporter_prefix_sequence ::= initial. | self. | export. | ( context. { context. } ) simple_name_sequence ::= [ simple_name . ] simple_name
The number of components in a composite name is unlimited. By
specifying a component, the current context for the additional component is
temporarily shifted during the evaluation. Thus, with a composite name such
as parent.title
, the parent
folder of the current
file context is made the current context in which the value of
title
is determined. Finally, the previously current context
becomes the current context again.
By specifying a prefix sequence the context or the name space of names can be changed during the export process:
Prefix | Effect |
---|---|
context |
The context of the surrounding list ,
newslist , or table element is used. The prefix
can be used several times to climb up several levels.Please note: The instructions modifyvar="set" ,
switch ... casecond , and
insertvalue="systemexecute"
create an additional current context. To reach the context that
encloses such an instruction, the context prefix must be
used twice. |
initial |
The initial context (of the file currently being exported) is used. |
export |
The name space is altered temporarily: The name that follows this prefix is interpreted as the name of an export variable. |
self |
The current context is referenced. |
A prefix is only effective while the value of the name component that
follows it is being determined. Thus, only the first
insertvalue="var"
instruction in the example below refers to the
context in which the list
instruction is evaluated. The second
insertvalue="var"
instruction is evaluated in the context of the
current toclist
element instead:
<npsobj list="toclist"> <b><npsobj insertvalue="var" name="context.title" /></b> - <npsobj insertvalue="var" name="title" /><br /> </npsobj>