Name
p:label-elements — The standard p:label-elements step.
Synopsis
The p:label-elements step generates a label for each matched
element and stores that label in the specified attribute.
| Input port | Primary | Sequence | Content types |
|---|---|---|---|
| source | ✔ | xml html |
| Output port | Primary | Sequence | Content types |
|---|---|---|---|
| result | ✔ | xml html |
| Option name | Type | Default value |
|---|---|---|
| attribute | xs:QName | 'xml:id' |
| label | XPathExpression | 'concat("_",$p:index)' |
| match | XSLTSelectionPattern | '*' |
| replace | xs:boolean | true() |
Declaration
1 |<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" type="p:label-elements">
| <p:input port="source" content-types="xml html"/>
| <p:output port="result" content-types="xml html"/>
| <p:option name="attribute" as="xs:QName" select="'xml:id'"/>
5 | <p:option xmlns:e="http://www.w3.org/1999/XSL/Spec/ElementSyntax"
| name="label"
| as="xs:string"
| select="'concat("_",$p:index)'"
| e:type="XPathExpression"/>
10 | <p:option xmlns:e="http://www.w3.org/1999/XSL/Spec/ElementSyntax"
| name="match"
| as="xs:string"
| select="'*'"
| e:type="XSLTSelectionPattern"/>
15 | <p:option name="replace" as="xs:boolean" select="true()"/>
|</p:declare-step>Errors
| Code | Description |
|---|---|
err:XC0023 | It
is a dynamic error (err:XC0023) if that expression matches
anything other than element nodes. |
Description
The p:label-elements step is a
standard XProc 3.0 step.
It is also described on XProcRef.org.
Additional examples
The XProc test suite contains examples of the p:label-elements step.