The <sax:command-source/> command is used in a sax pipeline to get source nodes from a command. When using this element, it is important to understand when it's children will not be executed until the surrounding pipeline element has finished building the pipeline.
<sax:pipeline xmlns:sax="http://www.xchain.org/sax/1.0"> <sax:command-source> ... </sax:command-source> ... <sax:result> </sax:pipeline>
The <sax:multi-document-result/> result adds a MultiDocumentResult element to the sax pipeline.
The <sax:null-result> element creates a sax result that does nothing with the sax events it receives from the pipeline.
a source, then be followed by zero or more transformations, followed by a result.<sax:pipeline xmlns:sax="http://www.xchain.org/sax/1.0"> ... <sax:null-result/> </sax:pipeline>
Name | Description | Type | Default Value | Java Return Type |
---|---|---|---|---|
name | The name of the output property to set. | org.xchain.annotations.AttributeType.JXPATH_VALUE | N/A | String |
value | The value of the output property to set. | org.xchain.annotations.AttributeType.JXPATH_VALUE | N/A | String |
<sax:output-property/> elements are placed inside <sax:transfromer/> elements to set output properties on a transformer.
<sax:pipeline xmlns:sax="http://www.xchain.org/sax/1.0"> <sax:source .../> ... <sax:transformer system-id="'relative-uri-of-template'"> <sax:output-property name="'name'" value="'value'"/> </sax:transformer> ... <sax:result .../> </sax:pipeline>
Name | Description | Type | Default Value | Java Return Type |
---|---|---|---|---|
name | The name of the parameter to set. | org.xchain.annotations.AttributeType.JXPATH_VALUE | N/A | String |
value | The value of the parameter to set. | org.xchain.annotations.AttributeType.JXPATH_VALUE | N/A | String |
<sax:parameter/> elements are placed inside <sax:transfromer/> elements to set parameters on a transformer.
<sax:pipeline xmlns:sax="http://www.xchain.org/sax/1.0"> <sax:source .../> ... <sax:transformer system-id="'relative-uri-of-template'"> <sax:parameter name="'name'" value="'value'"/> </sax:transformer> ... <sax:result .../> </sax:pipeline>
Name | Description | Type | Default Value | Java Return Type |
---|---|---|---|---|
uri-resolver | The uri resolver to use when building this pipeline. | org.xchain.annotations.AttributeType.JXPATH_VALUE | N/A | URIResolver |
The <sax:pipeline> command creates a sax pipeline, and then executes it. A pipeline should start with a source, then be followed by zero or more transformations, followed by a result.
<sax:pipeline xmlns:sax="http://www.xchain.org/sax/1.0"> ... </sax:pipeline>
Name | Description | Type | Default Value | Java Return Type |
---|---|---|---|---|
systemId | DEPRICATED: Use system-id instead. The system id to send the output to. | org.xchain.annotations.AttributeType.JXPATH_VALUE | N/A | String |
system-id | The system id to send output to. | org.xchain.annotations.AttributeType.JXPATH_VALUE | N/A | String |
path | The file path to send output to. | org.xchain.annotations.AttributeType.JXPATH_VALUE | N/A | String |
select | The object to send output to. | org.xchain.annotations.AttributeType.JXPATH_SELECT_SINGLE_NODE | N/A | Object |
The <sax:result/> command adds result objects to a pipeline. This command can add several types of results, based on the attributes defined on the command. To write output to a system id, add the system-id attribute to the command:
<sax:pipeline xmlns:sax="http://www.xchain.org/sax/1.0"> ... <sax:result system-id="'file:/some/path'"> </sax:pipeline>
To write output to a file path, add the path attribute:
<sax:pipeline xmlns:sax="http://www.xchain.org/sax/1.0"> ... <sax:result path="'/some/path'"> </sax:pipeline>
To write output to an object in the context, add the select attribute:
<sax:pipeline xmlns:sax="http://www.xchain.org/sax/1.0"> ... <sax:result select="$result"> </sax:pipeline>
The value of the select attribute must resovle to one of:
Name | Description | Type | Default Value | Java Return Type |
---|---|---|---|---|
method | org.xchain.annotations.AttributeType.JXPATH_VALUE | \xml\ | String | |
indent | org.xchain.annotations.AttributeType.JXPATH_VALUE | N/A | Boolean |
The <sax:serializer/> element adds a serialization stage to the pipeline.
Name | Description | Type | Default Value | Java Return Type |
---|---|---|---|---|
system-id | The system id of the stylesheet. | org.xchain.annotations.AttributeType.JXPATH_VALUE | N/A | String |
The <sax:transformer/> adds a transform to a sax pipeline. Currently, XChains supports both XSLT and STX transformations. To add a transform to a pipeline, include a <sax:transformer/> element between the source and result of a <sax:pipeline/> element.
<sax:pipeline xmlns:sax="http://www.xchain.org/sax/1.0"> <sax:source .../> ... <sax:transformer system-id="'relative-uri-of-template'"/> ... <sax:result .../> </sax:pipeline>
Parameters can be passed to a template by including <sax:parameter/> elements inside the <sax:transformer/> element.
<sax:pipeline xmlns:sax="http://www.xchain.org/sax/1.0"> <sax:source .../> ... <sax:transformer system-id="'relative-uri-of-template'"> <sax:parameter name="'name'" value="'value'"/> </sax:transformer> ... <sax:result .../> </sax:pipeline>
Since the transformer element is a command, you can optionally include a template by adding a conditional element around it. For example, you can add a template based on some test using the $lt;xchain:if/> element.
<sax:pipeline xmlns:sax="http://www.xchain.org/sax/1.0"> <sax:source .../> ... <xchain:if test="$test"/> <sax:transformer system-id="'relative-uri-of-template'"/> <:/xcahin:if> ... <sax:result .../> </sax:pipeline>
Name | Description | Type | Default Value | Java Return Type |
---|---|---|---|---|
system-id | org.xchain.annotations.AttributeType.JXPATH_VALUE | N/A | String |