This question is related to the last answer michael.hor257k , which in turn is related to the answer of Dimitar Novachev .
When using the stylesheet in the above answer ( michael.hor257k ) for large XML (about 60 MB an example XML is present below), and the conversion was successful.
When you try to use a different stylesheet, slightly different from michael.hor257k, and is designed to group elements (with a child sectPr) and their next siblings (until the next next sibling element with a child sectPr), recursively (i.e. group the elements into depth XML input).
XML input sample:
<body>
<p/>
<p>
<sectPr/>
</p>
<p/>
<p/>
<tbl/>
<p>
<sectPr/>
</p>
<p/>
</body>
, :
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates select="*[1] | *[sectPr]"/>
</xsl:copy>
<xsl:apply-templates select="following-sibling::*[1][not(sectPr)]"/>
</xsl:template>
<xsl:template match="*[sectPr]">
<myTag>
<xsl:copy>
<xsl:apply-templates select="*[1] | *[sectPr]"/>
</xsl:copy>
<xsl:apply-templates select="following-sibling::*[1][not(sectPr)]"/>
</myTag>
</xsl:template>
</xsl:stylesheet>
, OutOfMemoryError, XML 60 .
, , XSLT, michael.hor257k, Dimitre Novatchev, .
, OutOfMemoryError. , .