|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] local grouping
Hi all,
I have a grouping problem like this:
<g>
<line x="1"/>
<line x="2"/>
</g>
<g>
<line x="1"/>
<line x="1"/>
<line x="2"/>
</g>
and so on..
For each <g> element I want to group the children into sub elements
based on the value of x, so like this:
<g>
<g>
<line x="1"/>
</g>
<g>
<line x="2"/>
</g>
</g>
<g>
<g>
<line x="1"/>
<line x="1"/>
</g>
<g>
<line x="2"/>
</g>
</g>
I'm able to do this using the Muenchian Method and the extension
function intersection(). When I come across a <g> I want to iterate
across each possible x value that its children have and create a child
<g> for each one. So the code looks like this:
<xsl:key name="mykey" match="line" use="@x"/>
<xsl:template match="g">
<xsl:variable name="children" select="child::*"/>
<xsl:for-each
select="child::*[count(.|xalan:intersection(key(mykey, @x,
$children)[1]) = 1]">
<!-- build the inner g's -->
</xsl:for-each>
</xsl:template>
This works, but it is extremely slow. Does anyone have a more
efficient/faster way of doing this? It seems like it would be a common
problem, but I couldn't find any info about it.
Thanks,
Konrad
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








