Using XSLT for Data Translation
Once you’ve defined the match name/match value permutations for a given codeset and defined the return values for those permutations, you can write an XSLT translation program that invokes the codeset and applies the return values.
An XSLT translation is based on XSLT transformation structure. However, although you could combine both tasks into a single program, it’s better to keep them separate for easier understanding and maintenance.
Psft_function Nodes
To implement data translation capability, PeopleSoft Integration Broker provides a custom XSLT tag called psft_function. Each psft_function node in your program comprises a single instance of data translation that invokes a particular codeset and applies a specified set of codeset values.
Runtime invocation of codesets in XSLT is a two part process: first the input document is transformed and then all instances of psft_function are resolved in the output document.
Note:
You can insert a psft_function node anywhere inside the XSLT template containing the fields you want to translate. However, you’ll find it easiest to place it at or near the point in the template where the return values will go, to avoid having to specify a complex path to that location.
The psft_function tag has the following attributes:
| Attribute | Description |
|---|---|
|
name |
Set to codeset. |
|
codesetname |
Identifies the codeset whose name/value permutations you want to match in the input data. The routing that invokes this transform program identifies the initial and result nodes involved, and PeopleSoft Integration Broker examines their definitions to determine the From group and To group. The combination of these two keys and the codeset name identifies the codeset values definition to apply. |
|
source |
(Optional.) Overrides the name of the initial node specified by the routing. PeopleSoft Integration Broker uses the specified node’s codeset group as the From group key, thus invoking a different codeset values definition. |
|
dest |
(Optional.) Overrides the name of the result node specified by the routing. PeopleSoft Integration Broker uses the specified node’s codeset group as the To group key, thus invoking a different codeset values definition. |
Note:
The source and dest attributes don’t change the initial and result nodes specified in the routing; they just invoke the codeset groups to which those nodes belong.
Following is an example of psft_function using all of its attributes:
<psft_function name="codeset" codesetname="PS_SAP_PO_01"
source="SAP_02" dest="PSFT_03">...</psft_function>
Parm and Value Nodes
The psft_function node can contain two tags, parm and value:
-
Use the parm tag to specify a match name from the codeset values definition that you specified for this translation. You do this with the tag’s only attribute: name. Set this to a match name from the codeset values definition.
The parm node should contain a match value, usually specified as an xsl:value-of tag that identifies where the value resides in the input data. Use one parm node for each distinct match name in the codeset values definition.
-
Use the value tag to specify a return name from the codeset values definition that you specified for this translation. Also use the value tag to identify where to place the return value assigned to that return name for the matched permutation and how to apply that value.
Use one value node for each return name in the codeset values definition that you want in your output.
Value Tag Attributes
The value tag has the following attributes:
| Attribute | Description |
|---|---|
|
name |
Identifies a return name from the codeset values definition you specified for this translation. The return value assigned to this return name can be used as a data value or as a node name in your output depending on the attributes you specify. |
|
select |
Identifies an XSLT path (XPATH) to the location where the return value should be applied in the output data. |
|
createIfDNE |
(Optional.) Set to yes to ensure that the node specified by the select attribute is created if it does not exist yet. The return value is inserted as the value of that node. |
|
createNodeFromValue |
(Optional.) Set to yes to use the return value as the name of a new node, created where the select attribute specifies. The value tag can contain a valid XSLT value for that node, usually specified as an xsl:value-of tag that identifies where the value resides in the input data. |
Following is an example of a value node:
<value name="PS_RET_01" select="." createNodeFromValue="yes"><xsl:value-of
select="CreditCard"/></value>
Related Topics