Jump to content

xsl transformation using pass xml template


adsingh1

Recommended Posts

hi everbody,

i m very new to xsl.my requirement is transform a flat xml to nested xml using xsl transform for that i have to pass xml template file which contain xsl file path ,name and record placeholder.i dont knw how my template file ll be.

my input xml file is input.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:00.130</Attribute><Attribute name="count">7</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>

<record>
<field name="ContestNumber">1300000F</field>
<field name="ManagerRequisitionTitle">Project Manager</field>
</record>
<record>
<field name="ContestNumber">1300000H</field>
<field name="ManagerRequisitionTitle">Project Manager</field>
</record>
<record>
<field name="ContestNumber">1300000T</field>
<field name="ManagerRequisitionTitle">Project Manager</field>
</record>
<record>
<field name="ContestNumber">13000018</field>
<field name="ManagerRequisitionTitle">Project Manager</field>
</record>
</ExportXML></Content></Document></ns1:getDocumentByKeyResponse></soapenv:Body></soapenv:Envelope>
my xslt file is
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:itk="http://www.taleo.com/ws/integration/toolkit/2005/07">
<xsl:output method="text" encoding="UTF-8"/>
<xsl:template match="itk:record">
<xsl:text>JOB INFORMTION</xsl:text>
<xsl:value-of select="itk:field[@name=ContestNumber]"/>
<xsl:text>|</xsl:text>
<xsl:value-of select="itk:field[@name=ManagerRequisitionTitle]"/>
<xsl:text disable-output-escaping="yes"> </xsl:text>
<xsl:text>====</xsl:text>
<xsl:text disable-output-escaping="yes"> </xsl:text>
</xsl:template>
</xsl:stylesheet>
my expected output xml is output.xml

<?xml version="1.0" encoding="UTF-8" ?> <JobPositionPostings><JobPositionPosting><JobPositionPostingID>1300000F</JobPositionPostingID> <Industry><jobPost>Project Manager</jobPost> </Industry></JobPositionPosting></JobPositionPostings>

 

for xml input template file i dont have more idea about record place holder .please suggest me how it ll look like.

i created like this

<?xml version="1.0" encoding="UTF-8" ?> <?xml-stylesheet type="text/xsl" href="mycustom.xsl"?>

after that how to place xsl fetch value in this i dont know.

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...