[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:27:09 -0500
c analyze string
Thanks Michael,
That will do nicely and actually opens up a better way to do the whole task at hand. The path data is even more complex for example
<path style="fill-rule:evenodd;clip-rule:evenodd;stroke:none;" d="M145.876,414.692c3-1.9,5.6-0.5,7.8,4.3c0.1,1.8,0.2,2.7,0.5,3.6c0.3,0.9,0,1.9-0.9,2.8c-0.8,1-1.8,1-2.9,0s-1.8-0.899-2.3,0.4s0.4,2.6,2.8,3.9c1.1,0.5,1.4,1.199,1.7,2.6c0.2,1.3,0,1.9-0.6,1.7s-1.5-0.101-2.6,0.2c-1.1,0.399-1.6,0.1-1.5-1c0-1.101,0.1-1.9,0.1-2.301c0.5-2.1-0.4-2.6-2-1.699c-1.6,0.899-3,0.699-4.1-0.4c-2.1-2.5-1.7-3.6,0.3-3.3s1.5-0.2-1.3-1.601c0.1-4.1-0.9-6-3.8-6c1.5-2.5,2.6-2.899,4.1-1.6c1.5,1.4,2.4,0.9,2.7-1.4l2-0.199z"/>
with potential commands M, m, L ,l, H, h, V, v, C, c, S, s, Q, q, T, t, A, a, Z, and z commands. What you showed me with some rearrangement of my regex's will march thru much more robustly and rapidly!


Michael Kay wrote:

One way to do this is to write your analyze-string to process all the
matches, put the result in a sequence-valued variable, and select the first
item in that resulting sequence.

<xsl:variable name="s" as="xs:string*">
<xsl:analyze-string select="$d-path" regex="((\-?(\.|\d)+)(,| )+(\-?(\.|\d)+)){{1}}">
<xsl:sequence select="."/>
<xsl:analyze-string select="$s[1]">
regex="((\-?(\.|\d)+)(,| )+(\-?(\.|\d)+)){{1}}">
currentX=<xsl:value-of select="regex-group(2)"/>f;
currentY=<xsl:value-of select="regex-group(5)"/>f; </xsl:matching-substring>

Michael Kay

Current Thread


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.
First Name
Last Name
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.