xslt 2.0 分组

  • Post author:
  • Post category:其他

把数据拆成200个一组

 

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
    <xsl:template match="/">
        <a>
            <xsl:for-each-group select="x/data" group-adjacent="(position()-1) idiv 200 ">
                <sfdc:create xmlns:sfdc="urn:partner.soap.sforce.com">
                    <xsl:for-each select="current-group()">
                        <sObjects>
                            <type>bbbbb</type>
                            <Material__r>
                                <type>ddd</type>
                                <PN_NO__c>
                                    <xsl:value-of select="material"/>
                                </PN_NO__c>
                            </Material__r>
                            <Sub_Material__r>
                                <type>Product__c</type>
                                <PN_NO__c>
                                    <xsl:value-of select="sub_material"/>
                                </PN_NO__c>
                            </Sub_Material__r>
                            <Plant__c>
                                <xsl:value-of select="plant"/>
                            </Plant__c>
                        </sObjects>
                    </xsl:for-each>
                </sfdc:create>
            </xsl:for-each-group>
        </a>
    </xsl:template>
</xsl:stylesheet>

 

转载于:https://www.cnblogs.com/caihemm/p/7998135.html