Conversion Functions are functions that convert the data type of an input value into another data type.
The supported conversion functions are convert-to-number, convert-to-bool and convert-to-string.
Examples:
1. The convert-to-number function converts boolean or number values into number values: "true" converts into "1" and "false" converts into "0".
The following sample displays the hours worked in each department for every employee ID. The attribute "greater-than-1200" displays a "1" if the hours are greater than 1200, otherwise it displays a "0".

OUTPUT:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns:root xmlns:ns="http://www.tempuri.org/XML">
<ns:emp id="1">
<ns:hist hours-worked="300" greater-than-1200="0"/>
<ns:hist hours-worked="500" greater-than-1200="0"/>
<ns:hist hours-worked="3000" greater-than-1200="1"/>
<ns:hist hours-worked="100" greater-than-1200="0"/>
</ns:emp>
<ns:emp id="2">
<ns:hist hours-worked="1000" greater-than-1200="0"/>
<ns:hist hours-worked="8000" greater-than-1200="1"/>
<ns:hist hours-worked="5000" greater-than-1200="1"/>
</ns:emp>
<ns:emp id="3"/>
</ns:root>
2. The function convert-to-bool converts all data types besides DateTime format into boolean values.
All numbers other than "0" are converted into "true" and "0" is converted into "false".
String values other than "true" convert into "false".
The following example converts the values for "department" and "hours-worked" into the boolean "true" or "false" values.

OUTPUT:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns:root xmlns:ns="http://www.tempuri.org/XML">
<ns:hist department="Accounting" department-to-bool="false" hours-worked="300" hours-worked-to-bool="true"/>
<ns:hist department="Sales" department-to-bool="false" hours-worked="500" hours-worked-to-bool="true"/>
<ns:hist department="Accounting" department-to-bool="false" hours-worked="1000" hours-worked-to-bool="true"/>
<ns:hist department="Sales" department-to-bool="false" hours-worked="8000" hours-worked-to-bool="true"/>
<ns:hist department="Development" department-to-bool="false" hours-worked="3000" hours-worked-to-bool="true"/>
<ns:hist department="Development" department-to-bool="false" hours-worked="5000" hours-worked-to-bool="true"/>
<ns:hist department="Accounting" department-to-bool="false" hours-worked="100" hours-worked-to-bool="true"/>
</ns:root>
3. The function convert-to-string converts all data types into string values.
The following sample returns the hours worked for each employee in each department sorted by the employee`s ID.
The field hours-worked is converted into string and concatenated with the string "Hours worked:".

OUTPUT:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns:root xmlns:ns="http://www.tempuri.org/XML">
<ns:hist emp-id="1" department="Accounting" hours-worked="Hours worked:300"/>
<ns:hist emp-id="1" department="Sales" hours-worked="Hours worked:500"/>
<ns:hist emp-id="1" department="Development" hours-worked="Hours worked:3000"/>
<ns:hist emp-id="1" department="Accounting" hours-worked="Hours worked:100"/>
<ns:hist emp-id="2" department="Accounting" hours-worked="Hours worked:1000"/>
<ns:hist emp-id="2" department="Sales" hours-worked="Hours worked:8000"/>
<ns:hist emp-id="2" department="Development" hours-worked="Hours worked:5000"/>
</ns:root>