Do you want to create several result files, each containing a certain
number of records? Or simply one file where you wrap a certain number of
records?
In any way, assuming XSLT 2.0, you can use positional grouping e.g.
<xsl:for-each-group select="/optical/name" group-by="(position() - 1)
idiv 200">
<xsl:result-document select="result{position()}.xml">
<optical>
<xsl:copy-of select="current-group()"/>
</optical>
</xsl:result-document>
</xsl:for-each-group>
Am 12.07.2017 um 11:11 schrieb Rahul Singh
rahulsinghindia15(_at_)gmail(_dot_)com:
Hi,
Is there any posiblites in XSL to split XML in 200 200 chunk of
record in same xml by xsl, *below is inputm expected putput, xsl:*
<?xml version="1.0" encoding="UTF-8"?>
<optical>
<name>
<Doc>log00.txt</Doc>
</name>
<name>
<Doc>log00.txt</Doc>
</name>
<name>
<Doc>log00.txt</Doc>
</name>
<name>
<Doc>log00.txt</Doc>
</name>
<name>
<Doc>log00.txt</Doc>
</name>
<name>
<Doc>log00.txt</Doc>
</name>
<name>
<Doc>log00.txt</Doc>
</name>
<name>
<Doc>log00.txt</Doc>
</name>
<name>
<Doc>log00.txt</Doc>
</name>
<name>
<Doc>log00.txt</Doc>
</name>
<name>
<Doc>log00.txt</Doc>
</name>
</optical>
*Expected output:*
<?xml version="1.0" encoding="UTF-8"?>
<opticals>
<name>
<Doc>log00.txt</Doc>
</name>
<name>
<Doc>log00.txt</Doc>
</name>
<name>
<Doc>log00.txt</Doc>
</name>
<name>
<Doc>log00.txt</Doc>
</name>
</optical>
<optical>
<name>
<Doc>log00.txt</Doc>
</name>
<name>
<Doc>log00.txt</Doc>
</name>
<name>
<Doc>log00.txt</Doc>
</name>
<name>
<Doc>log00.txt</Doc>
</name>
<name>
<Doc>log00.txt</Doc>
</name>
<name>
<Doc>log00.txt</Doc>
</name>
<name>
<Doc>log00.txt</Doc>
</name>
</optical>
</opticals>
*
*
*XSL:*
*
*
*
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="optical">
<xsl:for-each select="name/Doc">
<xsl:copy-of select="."/>
<xsl:if test="not(position() eq last())">
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
*
XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe <-list/582271>
(by email <>)
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--