Tuesday, 13 August 2013

replace xml tag value from a fixed value using xslt

replace xml tag value from a fixed value using xslt

i want to replace the tag value with a specific value.it is poassible also
that it present multiple time in that. my input file is sample.xml
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns1:getDocumentByKeyResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://www.taleo.com/ws/integration/toolkit/2005/07"><Document
xmlns="http://www.taleo.com/ws/integration/toolkit/2005/07"><Attributes><Attribute
name="duration">0:00:06.654</Attribute><Attribute
name="count">113</Attribute><Attribute
name="entity">Requisition</Attribute><Attribute
name="mode">XML</Attribute><Attribute
name="version">http://www.taleo.com/ws/tee800/2009/01</Attribute></Attributes><Content>
<ExportXML xmlns="http://www.taleo.com/ws/integration/toolkit/2005/07">
<record>
<field name="JobAction">2</field>
<field name="JobType">false</field>
<field name="JobPositionPostingID">000065</field>
<field name="Website"/>
<field name="HiringOrgName">HIRING Division</field>
<field name="SummaryText"/>
<field name="FormattedName">AdityaNath</field>
<field name="JobPositionTitle">Project Manager</field>
<field name="JobIndustryCode"/>
<field name="JobFunctionCode">ADMINISTRATION</field>
<field name="JobRoleCode"/>
<field name="JobKeyword">To provide administrative and information
support to the HOD.</field>
<field name="Location">India</field>
<field name="SalaryCurrency">Indian Rupee (INR)</field>
<field name="MinimumSalary">200000.0</field>
<field name="MaximumSalary">400000.0</field>
<field name="summaryText1">Bachelor's degree</field>
<field name="MinimumExperiance">2</field>
<field name="MaximumExperiance">4</field>
<field name="UGQualifications"/>
<field name="UGSpecializations">BACHELOR_S_DEGREE_16_YEARS</field>
<field name="Email">AswaniAlekhya.Ugranam@lntinfotech.com</field>
</record>
</ExportXML></Content></Document></ns1:getDocumentByKeyResponse></soapenv:Body></soapenv:Envelope>
i have replace the code like tag
<field name="Location">India</field> with <Location>IND</Location>
<field name="Location">United State</field> with <Location>US</Location>
i have all country table list to replace.similary
<field name="JobPost">Project Manager</field> replace with
<JobPost>PM</JobPost>
i have all possible value and its replace code.i have rplace many tags at
a time. i m little bit confused that either use seprate xml file for
lookup or in xslt only declare everything.i am using xslt2.0.please
suggest me any solution.

No comments:

Post a Comment