Deletes namespaces from a document.
<p:declare-step type="p:namespace-delete"> <input port="source" primary="true" content-types="xml html" sequence="false"/> <output port="result" primary="true" content-types="xml html" sequence="false"/> <option name="prefixes" as="xs:string" required="true"/> </p:declare-step>
The p:namespace-delete
step deletes namespaces, for which the prefixes are listed in the prefixes
option, from elements and attributes
in the document appearing on its source
. The resulting document appears on the result
port.
Ports:
Type | Port | Primary? | Content types | Seq? | Description |
---|---|---|---|---|---|
|
|
|
|
| The document to delete the namespaces from. |
|
|
|
|
| The resulting document |
Options:
The p:namespace-delete
step takes the value of its prefixes
option, which must be a whitespace separated list of namespace-prefixes,
and finds out which namespaces are associated with these prefixes. These namespace prefixes must be defined in the pipeline. It then uses this
list to delete these namespaces from elements and attributes in the document appearing on the source
port. Elements and attributes
that were in one of these namespaces are now in the no-namespace. The resulting document appears on the result
port.
Note that matching is done on namespace name, not on namespace-prefix. This means that the prefix
as used in the prefixes
option might be different from the one used in the document to delete the namespace from. See the
Basic usage with different namespace-prefixes example.
The following example deletes the #myconfig
namespace, associated with the prefix con
, from the source
document.
Source document:
<config xmlns:con="#myconfig" con:status="special"> <con:thing>button</con:thing> </config>
Pipeline document:
<p:declare-step xmlns:con="#myconfig" xmlns:p="http://www.w3.org/ns/xproc" version="3.0"> <p:input port="source"/> <p:output port="result"/> <p:namespace-delete prefixes="con"/> </p:declare-step>
Result document:
<config status="special"> <thing>button</thing> </config>
The following example again deletes the #myconfig
namespace. However, the namespace-prefix used in the pipeline is different
from the one used in the source document.
Source document:
<config xmlns:con="#myconfig" con:status="special"> <con:thing>button</con:thing> </config>
Pipeline document:
<p:declare-step xmlns:ns1="#myconfig" xmlns:p="http://www.w3.org/ns/xproc" version="3.0"> <p:input port="source"/> <p:output port="result"/> <p:namespace-delete prefixes="ns1"/> </p:declare-step>
Result document:
<config status="special"> <thing>button</thing> </config>
p:namespace-delete
preserves all document-properties of the document(s) appearing on its source
port.
Error code | Description |
---|---|
It is a dynamic error if any prefix is not in-scope at the point where the | |
It is a dynamic error if a namespace is to be removed from an attribute and the element already has an attribute with the resulting
name. For instance, removing the namespace with the |
This description of the p:namespace-delete
step is for XProc version: 3.1. This is a required step (an XProc 3.1 processor must support this).
The formal specification for the p:namespace-delete
step can be found here.
The p:namespace-delete
step is part of categories:
The p:namespace-delete
step is also present in version:
3.0.