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

Re: analyze-string help?

Subject: Re: analyze-string help?
From: Wolfgang Laun <wolfgang.laun@xxxxxxxxx>
Date: Sun, 10 Jun 2012 09:00:16 +0200
Re:  analyze-string help?
A dash ('-') in the character set wildcard ("[...]") indicates a
character range (as you know).

You've just overlooked that using a '-' literally as a member in such
a set should be written first, after the opening bracket.

   regex="([-A-Za-z0-9 ,./]*) - ([ A-Za-z0-9/]*)"

Otherwise you include the range from space to comma, which just misses the
dash.

-W

On 10 June 2012 07:40, Dan Vint <dvint@xxxxxxxxx> wrote:
>
> I have the following value in the $title variable without the quotes
> "foo-119 Mode Module Batteries - Installation"
>
> I have a series of strings like this where I want to separate the content
after the last "space dash space" from everything the proceeds that point. So
I came up with the following:
>
> <xsl:analyze-string select="$title" regex="([A-Za-z0-9 -,./]*) - ([
A-Za-z0-9/]*)">
>      <xsl:matching-substring>
>            <techname><xsl:value-of select="regex-group(1)"/></techname>
>            <infoname><xsl:value-of select="regex-group(2)"/></infoname>
>     </xsl:matching-substring>
>     <xsl:non-matching-substring>
>            <xsl:comment>NO MATCH for techname and infoname "<xsl:value-of
select="$title"/>"</xsl:comment>
>     </xsl:non-matching-substring>
> </xsl:analyze-string>
>
> I'm getting this output:
>
>        <!--NO MATCH for techname and infoname "foo-119 Mode Module Batteries
- Installation"-->
> <techname>119 Mode Module Batteries</techname>
> <infoname>Installation</infoname>
>
> I was expecting all dashes to be captured except for the last one or at
least the first "space dash space", it looks like the pattern gets the "foo-"
and flags it as mismatched and then captures the other two strings. Can you
help me understand what is going on.
>
> thanks
> ..dan
>
> ---------------------------------------------------------------------------
> Danny Vint
>
> Panoramic Photography
> http://www.dvint.com
>
> voice: 619-938-3610

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.