How does X-Tension get the data?

Hello:
I want to write a X-Tension to calculate some data in the same Doctype.My Doctype is follow

<ino:doctype ino:name=“SalaryTax” ino:key=“ID_SalaryTax” ino:options=“READ INSERT UPDATE DELETE” ino:structure-index=“CONDENSED”>

<ino:node ino:name=“SalaryTax” ino:key=“id0000000194” ino:obj-type=“SEQ” ino:parent=“ID_SalaryTax” ino:search-type=“no”
ino:data-type=“Integer” ino:map-type=“InfoField”/>

<ino:node ino:name=“SalaryBegin” ino:key=“id0000000195” ino:obj-type=“CDATA”
ino:parent=“id0000000194” ino:search-type=“standard” ino:data-type=“Integer” ino:map-type=“InfoField”/>

<ino:node ino:name=“SalaryEnd” ino:key=“id0000000196” ino:obj-type=“CDATA”
ino:parent=“id0000000194” ino:search-type=“standard” ino:data-type=“WCHAR”
ino:map-type=“InfoField”/>

<ino:node ino:name=“Rate” ino:key=“id0000000196” ino:obj-type=“CDATA”
ino:parent=“id0000000194” ino:search-type=“standard” ino:data-type=“WCHAR”
ino:map-type=“InfoField”/>
</ino:doctype>

<ino:doctype ino:name=“Salary” ino:key=“ID_Salary” ino:options=“READ INSERT UPDATE DELETE” ino:structure-index=“CONDENSED”>

<ino:node ino:name=“Salary” ino:key=“id0000000209” ino:obj-type=“SEQ”
ino:parent=“ID_Salary” ino:search-type=“no”
ino:data-type=“Integer” ino:map-type=“InfoField”/>

<ino:node ino:name=“BaseSalary” ino:key=“id0000000210” ino:obj-type=“CDATA”
ino:parent=“id0000000209” ino:search-type=“standard” ino:data-type=“Integer” ino:map-type=“InfoField”/>

<ino:node ino:name=“Allowance” ino:key=“id0000000211” ino:obj-type=“CDATA”
ino:parent=“id0000000209” ino:search-type=“standard” ino:data-type=“Integer” ino:map-type=“InfoField”/>

<ino:node ino:name=“Major” ino:key=“id0000000212”
ino:obj-type=“PCDATA” ino:parent=“id0000000209”
ino:search-type=“no” ino:data-type=“Integer” ino:map-type=“InfoField”/>

</ino:doctype>

I want to write a X-Tension in Doctype Salary. It’ll calculate the Salary Tax. The Salary is BaseSalary + Allwance + Major. The Salary between SalaryBegin and SalaryEnd decide the Salary Tax Rate. I want to retrive the Salary to trigger the X-Tension to calculate the Salary , Tax Rate and SalaryTax. How could I define this SXSFun Element in Salary ? :confused:

How about writing a Query Server Extension function ?
Try these parameters:
* the XPATH epression to “Salary” as only Input parameter (XML-OBJ) and
* the result being the “Tax” (numeric or char-str).

You receive a fragment of a the salary doctype having as root node.
Parse it and collect “Base”, “Allowance” and “Major” to compute “Salary” from these.
Now use the “SxsXMLXql” Call-back (see documentation) to query
for the appropriate Rate in doc-type “SalaryTax”. Calculate the Tax by computing “Salary”+“Rate”.

Other solutions may be possible and better, too.

Use Mapping Server Extension only to store and retrieve (sub-)trees handled but Your own programme.
Regards, Michael

NB.: You chose to give the nodes “SalaryEnd” and “Rate” the same ino:key=“id0000000196”