This recipe explains how to a the parameter to the mapping file. Parameters are an important aspect of the transformation since they enable us to include some additional content into the transformation. In this recipe, we will show you how to add a parameter that will hold the generated UUID (universally unique identifier) information.
We will amend the example from the Using the xsl:for-each command recipe, by adding a parameter to the source part.
In the following steps, we will create a parameter and configure it to hold the generated UUID information:
<refNo>refNo5</refNo>
<refNo></refNo>
<ns1:ref>refNo5</ns1:ref>
<ns1:ref>36333838333930353933313438313534</ns1:ref>
<ns1:ref>36333838333930353933313438313534</ns1:ref>
The parameter in the transformation file is defined as the xsl:param
tag as follows:
<xsl:param name = "test" select = "oraext:generate-guid()"/>
The parameter tag consists of the name
and select
attributes. We are also able to define the constant value of the parameter. The syntax is similar to the one preceding with a difference that we don't need to set the select part as follows:
<xsl:param name = "testConst">Constant value</xsl:param>
The function of the parameter is taking the values from the outside and using them inside the transformation file. We can also define the default values of the parameter as we saw in the previous recipe.