|
Subject: Re: [xsl] is there any XSL Splitter to split XML in 200 chunk of record From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Wed, 12 Jul 2017 09:51:49 -0000 |
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@xxxxxxxxx:
> 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 <>)
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] is there any XSL Splitter to , Rahul Singh rahulsin | Thread | Re: [xsl] is there any XSL Splitter, Peter Flynn peter@xx |
| [xsl] is there any XSL Splitter to , Rahul Singh rahulsin | Date | Re: [xsl] is there any XSL Splitter, Peter Flynn peter@xx |
| Month |