[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: efficiently extracting a capture group from analy
Why not use the classic XPath 2.0 replace function?
replace($file, '^.+/my-(w+)\.xml$', '$1')
On 04.06.2022 17:30, Chris Papademetrious
christopher.papademetrious@xxxxxxxxxxxx wrote:
Hi everyone!
Given some filename string like
B <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
B <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
B xmlns:fn=http://www.w3.org/2005/xpath-functions
<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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|