Jump to content
Sign in to follow this  
adsingh1

xsl transformation using pass xml template

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.

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...