Sanjaya Liyanage wrote:
Hi all,
I want to create multiple Html files considering attribute values in XML.
My XML
<School>
<Student age="17">
<firstname>kasun</firstname>
<lastname>lakpriya<lastname>
</Student>
<Student age="17">
<firstname>thiwanka</firstname>
<lastname>somasiri</lastname>
</Student>
<Student age="20">
<firstname>eshan</firstname>
<lastname>sudharaka</lastname>
</Student>
<Student id="20">
<firstname>haritha</firstname>
<lastname>tennakoon</lastname>
</Student>
<School>
I want to generate two html files and each should contain the
details of students with same age.(here one html for students with age
17 and the other for age 20).How can I implement this in XSLT?Any help
is welcome.Thank you
XSLT 2.0 as implemented by Saxon 9, AltovaXML, XQSharp can create
multiple output files e.g.
<xsl:template match="/">
<xsl:for-each-group select="School/Student" group-by="@age">
<xsl:result-document
href="Students-aged-{current-grouping-key()}.xml">
<Students>
<xsl:copy-of select="current-group()"/>
</Students>
</xsl:result-document>
</xsl:for-each-group>
</xsl:template>
--
Martin Honnen --- MVP Data Platform Development
http://msmvps.com/blogs/martin_honnen/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--