Re: [xsl] efficiently extracting a capture group from analyze-string()

Subject: Re: [xsl] efficiently extracting a capture group from analyze-string()
From: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 4 Jun 2022 18:14:09 -0000
On Sat, Jun 4, 2022 at 8:29 AM Chris Papademetrious
christopher.papademetrious@xxxxxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Hi everyone!
>
>
>
> Given some filename string like
>
>
>
>   <xsl:variable name="file" select="'path/my-sometype.xml'"/>
>
>
>
> Ibd like to extract the bmy-(\w+)b part of the filename using
> analyze-string(). So far I have
>

Can the "path" part of the filename also contain the string "my-", and if
so, then would you provide a more precise definition of the wanted result?


Thanks,
Dimitre



>
>
>   <xsl:variable name="my-file-type" select="data(analyze-string($file,
> 'my-(\w+)')//fn:group[1])"/>
>
>
>
> which works by extracting the <group> descendant from the
> <analyze-string-result> tree, then converting it to text. Is there a more
> concise way to do this?
>
>
>
> I had to define
>
>
>
>   xmlns:fn=http://www.w3.org/2005/xpath-functions
>
>
>
> in my stylesheet for fn:group to match, and Ibm not sure if therebs a
> better way to do that too.
>
>
>
> Thanks!
>
>
>
>    - Chris
>
>
>
> -----
> Chris Papademetrious
>
> Tech Writer, Implementation Group
>
> (610) 628-9718 home office
>
> (570) 460-6078 cell
>
>
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/782854> (by
> email <>)
>


--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
To achieve the impossible dream, try going to sleep.
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they write
all patents, too? :)
-------------------------------------
Sanity is madness put to good use.
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.

Current Thread