on 01-29-2015 9:25 AM
Hi All,
I need a sample XSLT mapping as I am doing a split for each 998 line items. The requirement is to create a new document after every 998 line items . So if there are 1000 line items. It will be 998 with one document and 2 with the other document.
Hi Amit,
Try this:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="Position[position() mod 998 = 1]">
<PositionGroup>
<xsl:copy-of select=
".|following-sibling::Position[not(position() > 997)]"/>
</PositionGroup>
</xsl:template>
<xsl:template match="Position"/>
</xsl:stylesheet>
This XSL assumes the records in your XML are called <Position>. It uses the so called identity transform to copy the structure and the second template "counts" and copies your Positions. The 3rd empty template is also necessary, not sure anymore why.
Adapt it to your needs and let me know if it works.
Best regards,
Peter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Amit,
You can do it without XSLT mapping with a Message Mapping, It's better to choose message mapping over XSL mapping. Check this Claus Wallacher 's blog if it is helpful for you
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.