Splitting XML file with XSLT based on nodes -


i'm starting learn more using xslt parse xml - after researching other solutions, i"m still unable correctly write stylesheet break large xml file smaller xml files based on nodes.

i've got large xml file has 1500 or abstracts. structure of file looks like:

<rows>     <row>     <id>p-1-28-08</id>     <absno>4286</absno>     <title>..article title...</title>     <topic>..article topics..</topic>     <authors>..article authors..</authors>     <abstract>..article abstract..</abstract>     <keywords>..article keywords..</keywords>     </row>      <row>     <id>p-1-28-09</id>     <absno>4461</absno>     <title>..article title...</title>     <topic>..article topics..</topic>     <authors>..article authors..</authors>     <abstract>..article abstract..</abstract>     <keywords>..article keywords..</keywords>     </row>      <row>     <id>p-1-28-10</id>     <absno>4056</absno>     <<title>..article title...</title>     <topic>..article topics..</topic>     <authors>..article authors..</authors>     <abstract>..article abstract..</abstract>     <keywords>..article keywords..</keywords>     </row> <rows> 

the output i'm looking have each <row> node own xml file <absno> node filename.

is can done running original xml file through stylesheet? have time me see like?

<xsl:result-document> should make job. simple example (expecting document node <rows> in original xml file).

<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:fn="http://www.w3.org/2005/xpath-functions">     <xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>      <xsl:template match="/rows/row">         <xsl:result-document method="xml" href="{absno}.xml">             <xsl:copy-of select="." />         </xsl:result-document>     </xsl:template>  </xsl:stylesheet> 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -