I have a input file
Main.xml
<?xml version="1.0" encoding="utf-8" ?>
<Employees>
<Employee>
<id name="id">1</id>
<firstname >ABC</firstname>
<lastname >XYZ</lastname>
<age >32</age>
</Employee>
</Employees>
and 2 Lookup files:
Lookup1.xml
<?xml version="1.0" encoding="utf-8"?>
<Employees>
<Employee id="1">
<department code="102">HR</department>
</Employee>
</Employees>
Lookup2.xml
<?xml version="1.0" encoding="utf-8"?>
<Employees>
<Employee id="1">
<Country code="10">Canada</Country>
</Employee>
</Employees>
I want a ouput insuch a way that I passed a comma seprated values to scripts e.g “Country,Department” and it should generate the following output
<?xml version="1.0" encoding="utf-8" ?>
<Employees>
<Employee>
<id name="id">1</id>
<firstname >ABC</firstname>
<lastname >XYZ</lastname>
<age >32</age>
<va-object>
<va-metadata>
<related-content-ref area="decisions"
cite="102"
relationship="department" relevance="100"/>
<primary-class>
<super-class super-class="value-add"/>
<sub-class sub-class="department">HR</sub-class>
</primary-class>
</va-metadata>
</va-object>
<va-object>
<va-metadata>
<related-content-ref area="decisions"
cite="10"
relationship="country" relevance="100"/>
<primary-class>
<super-class super-class="value-add"/>
<sub-class sub-class="country">Canada</sub-class>
</primary-class>
</va-metadata>
</va-object>
</Employee>
</Employees>
But if I just Pass “Country” as parameter then script should not insert Department or vice-versa.I can achive this by having 2 different tempaltes country and department but i want this to be achived by using one generic template with parametes from an external file. Any help will be appreciated.
This stylesheet:
Output:
Note: “Is in sequence” XPath 1.0 test: