Split Xml into multiple files using xslt: Failed to transform document Exception: Could not find function: current-group -



Split Xml into multiple files using xslt: Failed to transform document Exception: Could not find function: current-group -

xslt:

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="xml" indent="yes"/> <xsl:template match="/objects"> <xsl:apply-templates/> </xsl:template> <xsl:template match="business"> <xsl:for-each-group select="workitem" group-starting-with="workitem[(position() -1)mod 3 = 0]"> <xsl:variable name="file" select="concat('workitem',position(),'.xml')"/> <xsl:result-document href="{$file}"> <objects> <business> <xsl:copy-of select="current-group()" /> </business> </objects> </xsl:result-document> </xsl:for-each-group> </xsl:template> </xsl:stylesheet>

inputxml:

<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <objects> <business> <workitem> .............. </workitem> <workitem> .............. </workitem> <workitem> .............. </workitem> <workitem> .............. </workitem> <workitem> .............. </workitem> <workitem> .............. </workitem> </business> </objects>

expected output: 2 separate files 3 workitems in each.

error received:

error: xslt service failed. failed transform document exception: javax.xml.transform.transformerexception: not find function: current-group

your stylesheet uses xslt 2.0 features running using xslt 1.0 processor.

xslt-2.0

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -