xsl-list
[Top] [All Lists]

RE: Performance Tuning

2004-11-10 15:41:23
Mike,

With Saxon8 this is likely to perform much better
using positional grouping:
xsl:for-each-group group-starting-with="pattern",
for example. I'm afraid I
don't have time today to give you more detail.

Somehow I am not able to use the above grouping.
With the input XML like this:

<Document>
        - <ParentGroup> Node1 </ParentGroup>
        - <ChildGroup> Node1.1 </ChildGroup>
        - <Child Node1>1.1.1 </Child Node1>
        - <Child Node2>1.1.2 </Child Node2>
        - <Child Node3>1.1.3 </Child Node3>     
        - <ParentGroup> Node1 </ParentGroup>
        - <ChildGroup> Node1.2 </ChildGroup>
        - <Child Node1>1.2.1 </Child Node1>
        - <Child Node2>1.2.2 </Child Node2>
        - <Child Node3>1.2.3 </Child Node3>     
        - <ParentGroup> Node1 </ParentGroup>
        - <ChildGroup> Node1.3 </ChildGroup>
        - <Child Node1>1.3.1 </Child Node1>
        - <Child Node2>1.3.2 </Child Node2>
        - <Child Node3>1.3.3 </Child Node3>     
        - <ParentGroup> Node1 </ParentGroup>
        - <ChildGroup> Node1.3 </ChildGroup>
        - <Child Node1>1.3.x </Child Node1>
        - <Child Node2>1.3.y </Child Node2>
        - <Child Node3>1.3.z </Child Node3>     

        - <ParentGroup> Node2 </ParentGroup>
        - <ChildGroup> Node2.1 </ChildGroup>
        - <Child Node1>2.1.1 </Child Node1>
        - <Child Node2>2.1.2 </Child Node2>
        - <Child Node3>2.1.3 </Child Node3>     
        - <ParentGroup> Node2 </ParentGroup>
        - <ChildGroup> Node2.2 </ChildGroup>
        - <Child Node1>2.2.1 </Child Node1>
        - <Child Node2>2.2.2 </Child Node2>
        - <Child Node3>2.2.3 </Child Node3>     
        - <ParentGroup> Node2 </ParentGroup>
        - <ChildGroup> Node2.3 </ChildGroup>
        - <Child Node1>2.3.1 </Child Node1>
        - <Child Node2>2.3.2 </Child Node2>
        - <Child Node3>2.3.3 </Child Node3>     
...........
</Document>

Here I have only 2 distinct ParentGroups
With this XSL
<xsl:param name="priroot">ParentGroup</xsl:param>
<xsl:param name="secroot">ChildGroup</xsl:param>

<xsl:key name="PRI" match="ParentGroup" use="."/>
<xsl:key name="SEC" match="ChildGroup" use="."/>

<CUSTOMER_RELATIONS>
<xsl:variable name="var_1" select="Document/Parent
Group" />
<xsl:variable name="var_2" select="Document/Child
Group" />
<xsl:variable name="var_3" select="Document/Child
Node1" />
<xsl:variable name="var_4" select="Document/Child
Node2" />
<xsl:variable name="var_5" select="Document/Child
Node3" />
        <xsl:for-each-group select="Document/ParentGroup"
group-starting-with="ParentGroup">
        <xsl:element name="{$priroot}">
        <xsl:variable name="priId" select="." />
                </xsl:element>
        </xsl:for-each-group>
</CUSTOMER_RELATIONS>


I am getting the Parent group description repeated for
each grop node.

<Document>
 <ParentGroup Node1>
  <PRIMARY_CUST_DESC>Node1+ 1.1.3</PRIMARY_CUST_DESC>
  <ChildGroup Node1.1 >
        <ACCOUNT_SUMMARY>
        - <Child Node1>1.1.1 </Child Node1>
        - <Child Node2>1.1.2 </Child Node2>
        - <Child Node3>1.1.3 </Child Node3>
        <ACCOUNT_SUMMARY>
  </ChildGroup>
  <PRIMARY_CUST_DESC>Node1+ 1.2.3</PRIMARY_CUST_DESC>
  <ChildGroup Node1.2 >
        <ACCOUNT_SUMMARY>
        - <Child Node1>1.2.1 </Child Node1>
        - <Child Node2>1.2.2 </Child Node2>
        - <Child Node3>1.2.3 </Child Node3>
        </ACCOUNT_SUMMARY>
  </ChildGroup>
  <PRIMARY_CUST_DESC>Node1+ 1.3.3</PRIMARY_CUST_DESC>
  <ChildGroup Node1.3 >
        <ACCOUNT_SUMMARY>
        - <Child Node1>1.3.1 </Child Node1>
        - <Child Node2>1.3.2 </Child Node2>
        - <Child Node3>1.3.3 </Child Node3>
        </ACCOUNT_SUMMARY>
  </ChildGroup>
 </ParentGroup> 
 <ParentGroup Node2>    
 <PRIMARY_CUST_DESC>Node2+ 2.1.3</PRIMARY_CUST_DESC>
  <ChildGroup Node2.1 >
        <ACCOUNT_SUMMARY>
        - <Child Node1>2.1.1 </Child Node1>
        - <Child Node2>2.1.2 </Child Node2>
        - <Child Node3>2.1.3 </Child Node3>
        </ACCOUNT_SUMMARY>
  </ChildGroup>
  <PRIMARY_CUST_DESC>Node2+ 2.2.3</PRIMARY_CUST_DESC>
  <ChildGroup Node2.2 >
        <ACCOUNT_SUMMARY>
        - <Child Node1>2.2.1 </Child Node1>
        - <Child Node2>2.2.2 </Child Node2>
        - <Child Node3>2.2.3 </Child Node3>
        </ACCOUNT_SUMMARY>
  </ChildGroup>
  <PRIMARY_CUST_DESC>Node2+ 2.3.3</PRIMARY_CUST_DESC>
  <ChildGroup Node2.3 >
        <ACCOUNT_SUMMARY>
        - <Child Node1>2.3.1 </Child Node1>
        - <Child Node2>2.3.2 </Child Node2>
        - <Child Node3>2.3.3 </Child Node3>
        </ACCOUNT_SUMMARY>
  </ChildGroup>
 </ParentGroup> 
...........
</Document>

Can you please let me know where am I doing wrong.

Thanks in advance.
Bhupendra.



        
        
                
___________________________________________________________ 
ALL-NEW Yahoo! Messenger - all new features - even more fun! 
http://uk.messenger.yahoo.com