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

RE: Re: xsl:analyze-string use clarification needed

Subject: RE: Re: xsl:analyze-string use clarification needed
From: cknell@xxxxxxxxxx
Date: Tue, 23 Jan 2007 10:03:13 -0500
RE: Re:  xsl:analyze-string use clarification needed
Thanks. I've modified the expression to "^[A-Z]+", and I've got what I need.
--
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     Andrew Welch <andrew.j.welch@xxxxxxxxx>
Sent:     Tue, 23 Jan 2007 14:58:32 +0000
To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Re:  xsl:analyze-string use clarification needed

On 1/23/07, cknell@xxxxxxxxxx <cknell@xxxxxxxxxx> 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>

If you are using regex-group() then you need to specify a group in your regex using brackets ( ) , just using . if you dont have any groups.

Also, I'm not sure why you expect "XY" using that regex - you should
expect "XY02"

cheers
andrew

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.