xsl-list
[Top] [All Lists]

Re: [xsl] xsl:analyze-string use clarification needed

2007-01-23 08:00:22
Isn't the regular expressions in Xslt 2.0 following the rules of
regular expression laid out in XML Schema
http://www.w3.org/TR/xmlschema-2/#regexs ? That an expression is
automatically anchored at the head and tail. so i guess you don't need
the starting ^.

Cheers,
Bryan Rasmussen

On 1/23/07, cknell(_at_)onebox(_dot_)com <cknell(_at_)onebox(_dot_)com> wrote:
I'm having a problem understanding xsl:analyze-string, or perhaps the problem 
is with my regex.

I'm working with a VARCHAR2 column in an Oracle database. This column has been 
"re-purposed" to hold three data items in a formatted structure. I need to 
inspect this field for data entry errors. One of the most common errors is the failure to 
include one or more spaces to separate the individual data items.

I have written the test template below. What I expect to see as output is "XY". What I 
get is "".

Can someone point out my error(s)? Thanks.

<xsl:template match="/">
  <xsl:variable name="position-code-candidate">
    <xsl:analyze-string select="'XY02/28/2007 L'" regex="^\w+">
      <xsl:matching-substring>
        <xsl:value-of select="regex-group(1)" />
      </xsl:matching-substring>
    </xsl:analyze-string>
  </xsl:variable>
  <xsl:value-of select="$position-code-candidate" />
</xsl:template>

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

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