xsltbeginner
11-30-2008, 02:07 PM
Hi all,
I want to merge data from one file into another using xslt, i am totally new with xslt so don't know how to do it and has to do it for 10 records having same id's in both files.
files are:
filexml1:
<ListRecords>
<record>
<header>
<identifier>some value herer</identifier>
<datestamp>2008-07-14T09:23:25Z</datestamp>
</header>
<metadata>
<group xsi:schemaLocation="some url">
<title>User manipulating this</title>
<feed>
<title>My feed</title>
<url>no.url.available</url>
<item>
<!--Here <guid> is unique id used to merge record from both files based on it...>
<guid>oai:triple-l:2c7ba037-52a6-4323-97dd-b6ea1cdbfd18</guid>
<events>
<event>
<dateTime>2008-03-26T13:27:49.00</dateTime>
<action>
<actionType>doSomeAtcion</actionType>
</action>
</event>
</events>
</item>
</feed>
</group>
</metadata>
</record>
<!....More Records here....>
</ListRecords>
filexml2:
<ListRecords>
<record>
<header>
<!... Here <identifer> is unique id to merge records based on this id....>
<identifier>oai:triple-l:2c7ba037-52a6-4323-97dd-b6ea1cdbfd18</identifier>
<datestamp>2007-05-29T15:55:00Z</datestamp>
<datestampasdatetime>2007-05-29T17:55:00+02:00</datestampasdatetime>
</header>
<metadata>
<lom xsi:schemaLocation="some url">
<general >
<identifier>
<catalog>oai</catalog>
<entry>oai:triple-l:2c7ba037-52a6-4323-97dd-b6ea1cdbfd18</entry>
</identifier
<title>
<langstring>
<value>Graduation mw. S. de Caralt</value>
<language>en</language>
</langstring>
</title>
<catalogentry>
<catalog>nl.wur.wurtv</catalog>
<entry>
<langstring>
<value>2c7ba037-52a6-4323-97dd-b6ea1cdbfd18</value>
<language>x-none</language>
</langstring>
</entry>
</catalogentry>
<grouplanguage>en</grouplanguage>
<description>
<langstring>
<value>Sponge Culture: Learning from Biology and Ecology</value>
<language>en</language>
</langstring>
</description>
</general>
<lifecycle xmlns="" />
<metametadata >
<metadatascheme>LORENET</metadatascheme>
</metametadata>
</lom>
</metadata>
</record>
<….More Records here…..!>
</ListRecords>
I want to merge all elements after <header> ( starting from element <metadata> and ending at </metadata> ) from filexml2 into filexml1 after its </metadata> element at the very end before </record> and finally </LIstRecords> elements based on unique id's in both files. Output file might look like.
fileoutput:
<ListRecords>
<record>
<header>
<identifier>some value herer</identifier>
<datestamp>2008-07-14T09:23:25Z</datestamp>
</header>
<metadata>
<group xsi:schemaLocation="some url">
<title>User manipulating this</title>
<feed>
<title>My feed</title>
<url>no.url.available</url>
<item>
<!--Here <guid> is unique id used to merge record from both files based on it...>
<guid>oai:triple-l:2c7ba037-52a6-4323-97dd-b6ea1cdbfd18</guid>
<events>
<event>
<dateTime>2008-03-26T13:27:49.00</dateTime>
<action>
<actionType>doSomeAtcion</actionType>
</action>
</event>
</events>
</item>
</feed>
</group>
</metadata>
<!...Here starts the merged part from filxml2...>
<metadata>
<group xsi:schemaLocation="some url">
<title>User manipulating this</title>
<feed>
<title>My feed</title>
<url>no.url.available</url>
<item>
<!--Here <guid> is unique id used to merge record from both files based on it...>
<guid>oai:triple-l:2c7ba037-52a6-4323-97dd-b6ea1cdbfd18</guid>
<events>
<event>
<dateTime>2008-03-26T13:27:49.00</dateTime>
<action>
<actionType>doSomeAtcion</actionType>
</action>
</event>
</events>
</item>
</feed>
</group>
</metadata>
<!....Here ends the merged part from filexml2....>
</record>
<!....More Records here....>
</ListRecords>
Plese help me how i will perform it in xslt.
Thanx...
I want to merge data from one file into another using xslt, i am totally new with xslt so don't know how to do it and has to do it for 10 records having same id's in both files.
files are:
filexml1:
<ListRecords>
<record>
<header>
<identifier>some value herer</identifier>
<datestamp>2008-07-14T09:23:25Z</datestamp>
</header>
<metadata>
<group xsi:schemaLocation="some url">
<title>User manipulating this</title>
<feed>
<title>My feed</title>
<url>no.url.available</url>
<item>
<!--Here <guid> is unique id used to merge record from both files based on it...>
<guid>oai:triple-l:2c7ba037-52a6-4323-97dd-b6ea1cdbfd18</guid>
<events>
<event>
<dateTime>2008-03-26T13:27:49.00</dateTime>
<action>
<actionType>doSomeAtcion</actionType>
</action>
</event>
</events>
</item>
</feed>
</group>
</metadata>
</record>
<!....More Records here....>
</ListRecords>
filexml2:
<ListRecords>
<record>
<header>
<!... Here <identifer> is unique id to merge records based on this id....>
<identifier>oai:triple-l:2c7ba037-52a6-4323-97dd-b6ea1cdbfd18</identifier>
<datestamp>2007-05-29T15:55:00Z</datestamp>
<datestampasdatetime>2007-05-29T17:55:00+02:00</datestampasdatetime>
</header>
<metadata>
<lom xsi:schemaLocation="some url">
<general >
<identifier>
<catalog>oai</catalog>
<entry>oai:triple-l:2c7ba037-52a6-4323-97dd-b6ea1cdbfd18</entry>
</identifier
<title>
<langstring>
<value>Graduation mw. S. de Caralt</value>
<language>en</language>
</langstring>
</title>
<catalogentry>
<catalog>nl.wur.wurtv</catalog>
<entry>
<langstring>
<value>2c7ba037-52a6-4323-97dd-b6ea1cdbfd18</value>
<language>x-none</language>
</langstring>
</entry>
</catalogentry>
<grouplanguage>en</grouplanguage>
<description>
<langstring>
<value>Sponge Culture: Learning from Biology and Ecology</value>
<language>en</language>
</langstring>
</description>
</general>
<lifecycle xmlns="" />
<metametadata >
<metadatascheme>LORENET</metadatascheme>
</metametadata>
</lom>
</metadata>
</record>
<….More Records here…..!>
</ListRecords>
I want to merge all elements after <header> ( starting from element <metadata> and ending at </metadata> ) from filexml2 into filexml1 after its </metadata> element at the very end before </record> and finally </LIstRecords> elements based on unique id's in both files. Output file might look like.
fileoutput:
<ListRecords>
<record>
<header>
<identifier>some value herer</identifier>
<datestamp>2008-07-14T09:23:25Z</datestamp>
</header>
<metadata>
<group xsi:schemaLocation="some url">
<title>User manipulating this</title>
<feed>
<title>My feed</title>
<url>no.url.available</url>
<item>
<!--Here <guid> is unique id used to merge record from both files based on it...>
<guid>oai:triple-l:2c7ba037-52a6-4323-97dd-b6ea1cdbfd18</guid>
<events>
<event>
<dateTime>2008-03-26T13:27:49.00</dateTime>
<action>
<actionType>doSomeAtcion</actionType>
</action>
</event>
</events>
</item>
</feed>
</group>
</metadata>
<!...Here starts the merged part from filxml2...>
<metadata>
<group xsi:schemaLocation="some url">
<title>User manipulating this</title>
<feed>
<title>My feed</title>
<url>no.url.available</url>
<item>
<!--Here <guid> is unique id used to merge record from both files based on it...>
<guid>oai:triple-l:2c7ba037-52a6-4323-97dd-b6ea1cdbfd18</guid>
<events>
<event>
<dateTime>2008-03-26T13:27:49.00</dateTime>
<action>
<actionType>doSomeAtcion</actionType>
</action>
</event>
</events>
</item>
</feed>
</group>
</metadata>
<!....Here ends the merged part from filexml2....>
</record>
<!....More Records here....>
</ListRecords>
Plese help me how i will perform it in xslt.
Thanx...