[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: how to ask analyze-string for only one match?

Subject: Re: how to ask analyze-string for only one match?
From: Roger I Martin PhD <hypernexdev@xxxxxxxxxxxxxxx>
Date: Mon, 23 Jan 2006 17:24:05 -0500
svg to java2d
cknell@xxxxxxxxxx wrote:

This stylesheet does what you asked. Of course, I can't see the rest of the stylesheet to see if there are any other issues, but this should be the seed you need.

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:strip-space elements="*" />


 <xsl:template match="/path">
   <xsl:analyze-string select="@d" regex="^M (\d+ )(\d+ )">
     <xsl:matching-substring>
       currentX=<xsl:value-of select="regex-group(1)"/>f;
       currentY=<xsl:value-of select="regex-group(2)"/>f;
     </xsl:matching-substring>
   </xsl:analyze-string>
 </xsl:template>

</xsl:stylesheet>

I'll push it to open source cvs at a sourceforge project for interest sake. It will take up to four hours to appear there. The svg path spec is much more complicated so many more cases need to be considered
http://www.w3.org/TR/SVG11/paths.html#PathData
The M can repeat and there may or may not be spaces. Or negative sign. Or decimal point.
What I am doing is translating svg to Java2D, compiling to class and instantiating to render the vector graphics. Works surprisingly well. Many images will render faster than bringing up a whole rendering engine. And after the class is made, it can be redisplayed even faster. And can have a very small foot print. I do it for x3d to Java3D and lg3d as well. The stylesheet(s) will be at http://cvs.sourceforge.net/viewcvs.py/mathml-x/mathml-x/stylesheets/ (takes time to perculate thru).



What Micheal showed, changes the direction and approach toward the better. I had replied but haven't seen it show up on the list yet.


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.