xsl-list
[Top] [All Lists]

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

2006-01-23 14:47:49
So, are you saying that with these elements:

  currentX=<xsl:value-of select="regex-group(2)"/>f;
  currentY=<xsl:value-of select="regex-group(5)"/>f;

you wish to extract the two numbers to the right of 'M'?

--
Charles Knell
cknell(_at_)onebox(_dot_)com - email



-----Original Message-----
From:     Roger I Martin PhD <hypernexdev(_at_)hypernexinc(_dot_)com>
Sent:     Mon, 23 Jan 2006 15:51:46 -0500
To:       xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject:  [xsl] how to ask analyze-string for only one match?

I'm transforming svg.  In particular path data noted by the d attribute.
-----
 <path d="M 100 100 L 300 100 L 200 300 z"
       fill="red" stroke="blue" stroke-width="3" />
----
In this example there are 3 matches 100 100, 300 100 and 200 300. The following gives me all 3 but I want it to stop after the first match. Added a {1} for group 1 but that doesn't stop the rematch from occuring.
-----
   <xsl:template name="apply-absolute-point">
   <xsl:param name="d-path" select="''"/>
<xsl:analyze-string select="$d-path" regex="((\-?(\.|\d)+)(,| )+(\-?(\.|\d)+)){{1}}">
             <xsl:matching-substring>
         currentX=<xsl:value-of select="regex-group(2)"/>f;
         currentY=<xsl:value-of select="regex-group(5)"/>f;
             </xsl:matching-substring>
           </xsl:analyze-string>
   </xsl:template>
----

--~------------------------------------------------------------------
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>
--~--