Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!--Select by node and group by child node-->
- <xsl:when test="$from='node-childnode'">
- <xsl:for-each-group select="$compose//*[name()=$sel]" group-by="child::*[name()=$group]">
- <xsl:sort select="current-grouping-key()" />
- <element key="{current-grouping-key()}">
- <xsl:if test="number(current-group()[1])=number(current-group()[1])">
- <xsl:attribute name="max" select="max(current-group())"/>
- <xsl:attribute name="sum" select="sum(current-group())"/>
- </xsl:if>
- <xsl:copy-of select="current-group()[1]"/>
- </element>
- </xsl:for-each-group>
- </xsl:when>
- <xsl:variable name="oSel">
- <xsl:choose>
- <xsl:when test="starts-with($from,'oclass-')">
- <xsl:value-of select="$compose//*[contains(@outputclass,$sel)]"/>
- </xsl:when>
- <xsl:when test="starts-with($from,'node-')">
- <xsl:value-of select="$compose//*[name()=$sel]"/>
- </xsl:when>
- <xsl:otherwise/>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="oGroup">
- <xsl:choose>
- <xsl:when test="ends-with($from,'-attribute')">
- <xsl:value-of select="*/@*[local-name()=$group]"/>
- </xsl:when>
- <xsl:when test="ends-with($from,'-childnode')">
- <xsl:value-of select="*/*[name()=$group]"/>
- </xsl:when>
- <xsl:when test="ends-with($from,'-parentnode')">
- <xsl:value-of select="parent::*[name()=$group]"/>
- </xsl:when>
- <xsl:when test="ends-with($from,'-followingnode')">
- <xsl:value-of select="following-sibling::*[name()=$group][1]"/>
- </xsl:when>
- <xsl:when test="ends-with($from,'-precedingnode')">
- <xsl:value-of select="preceding-sibling::*[name()=$group][1]"/>
- </xsl:when>
- <xsl:otherwise/>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="test">
- <!--<xsl:for-each-group select="saxon:evaluate($oSel)" group-by="saxon:evaluate($oGroup)">-->
- <xsl:for-each-group select="saxon:evaluate($oSel)" group-by="saxon:evaluate($oGroup)">
- <element key="{current-grouping-key()}">
- <xsl:if test="number(current-group()[1])=number(current-group()[1])">
- <xsl:attribute name="max" select="max(current-group())"/>
- <xsl:attribute name="sum" select="sum(current-group())"/>
- </xsl:if>
- <xsl:copy-of select="current-group()[1]"/>
- </element>
- </xsl:for-each-group>
- </xsl:variable>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement