... Just out of curiosity here (it may be a business requirement or
whatnot, I don't know), why are you trying to construct an SVG path out
of (what looks to be) ellipse creation information? Why not just
something like:
<ellipse transform="rotate({(_at_)ellipse_angle})" cx="{(_at_)x}" cy="{(_at_)y}"
rx="{(_at_)ellipse_major_radius}" ry="{(_at_)ellipse_minor_radius}"/>?
~ Scott
-----Original Message-----
From: Sujata Gohad [mailto:sgohad(_at_)asu(_dot_)edu]
Sent: Sunday, October 07, 2007 4:50 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Optimizing XSLT iteration
Hello folks,
I have an XML file in the format:
<document src="image.tif" >
<page x="0" y= "0" width="1012" height="506" >
<attribute src="h" name= "page.h" value="TODO" />
<component id="component1" >
<trace id="component3.trace1">
<attribute src="h" name= "trace.h" value="TODO" />
<locus x="371" y= "36" ellipse_x="371.269" ellipse_y="35.5983"
ellipse_major_radius= "14.3639" ellipse_minor_radius="9.81155"
ellipse_angle="0.148638" ellipse_major_axis= "0.988974 0.148091"
ellipse_minor_axis="0.148091 -0.988974" intensity="0" thickness="2"
color= "#(TODO)" KM2="1" KM4="3" KM8= "3" />
<locus x="371" y= "37" ellipse_x="371.428" ellipse_y="36.853"
ellipse_major_radius= "14.3171" ellipse_minor_radius="9.86581"
ellipse_angle="0.327775" ellipse_major_axis= "0.946761 0.321938"
ellipse_minor_axis="0.321938 -0.946761" intensity="0" thickness="2"
color= "#(TODO)" KM2="1" KM4="3" KM8= "3" />
<locus x="371" y= "38" ellipse_x="371.532" ellipse_y="38.2574"
ellipse_major_radius= "18.3574" ellipse_minor_radius="15.0037"
ellipse_angle="0.508344" ellipse_major_axis= "0.873552 0.486731"
ellipse_minor_axis="0.486731 -0.873552" intensity="0" thickness="1"
color= "#(TODO)" KM2="0" KM4="1" KM8= "3" />
<locus x="371" y= "39" ellipse_x="371.482" ellipse_y="39.5204"
ellipse_major_radius= "17.479" ellipse_minor_radius="15.5356"
ellipse_angle="0.524238" ellipse_major_axis= "0.865705 0.500554"
ellipse_minor_axis="0.500554 -0.865705" intensity="0" thickness="3"
color= "#(TODO)" KM2="0" KM4="1" KM8= "3" />
...
...
...
<locus x="350" y= "43" ellipse_x="350.593" ellipse_y="43.4193"
ellipse_major_radius= "30.7193" ellipse_minor_radius="25.6399"
ellipse_angle="2.10944" ellipse_major_axis= "-0.512976 0.858403"
ellipse_minor_axis="-0.858403 -0.512976" intensity="0" thickness="5"
color= "#(TODO)" KM2="0" KM4="2" KM8= "0" />
</trace >
</component >
</page >
</document >
In order to convert it to SVG format:
<?xml version=' 1.0' encoding='UTF-8'?>
<?xml-stylesheet href="hvm_to_svg.css" type="text/css"? >
<svg height="506" width= "1012"
xmlns:xlink="http://www.w3.org/1999/xlink "
xmlns="http://www.w3.org/2000/svg ">
<image height="506" width= "1012" xlink:href="foreground.png" />
<path d="M371.269 35.5983 L371.428 36.853 L371.532 38.2574 L371.482
39.5204 .... L350.593 43.4193" class="trace"/ >
</svg >
(where .... is replaced by more "Lx y" components)
I am using the XSLT:
....
<xsl:for-each select="component">
<xsl:for-each select="trace">
<path >
<xsl:attribute name="class">
trace</xsl:attribute >
<xsl:attribute name="d">
<xsl:for-each select="locus[position()=1]">
<xsl:text >M </xsl:text >
<xsl:value-of select="@ellipse_x"/ >
<xsl:text > </xsl:text >
<xsl:value-of select="@ellipse_y"/ >
</xsl:for-each >
<xsl:for-each select="locus[position()!=1]">
<xsl:text > L</xsl:text >
<xsl:value-of select="@ellipse_x"/ >
<xsl:text > </xsl:text >
<xsl:value-of select="@ellipse_y"/ >
</xsl:for-each >
</xsl:attribute >
</path >
</xsl:for-each >
</xsl:for-each >
....
XSLT profiler shows that 80% of the time is spent in enumerating the
"locus" elements?
Is there a way to faster iteration of the "locus" elements?
Thanks
- Sujata
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--