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

Re: passing a regex matched substring to the result-d

Subject: Re: passing a regex matched substring to the result-document
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Fri, 04 Sep 2009 19:20:56 +0200
Re:  passing a regex matched substring to the  result-d
Manuel Souto Pico wrote:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output method="xml" encoding="UTF-16" standalone="no" name="xml" indent="yes"/>
<xsl:strip-space elements="*" />
<xsl:template match="/">
<xsl:param name="COMMON"/> <xsl:for-each select="//file">
<xsl:variable name="srcfilename" select="base-uri(/)"/>
<xsl:analyze-string select="$srcfilename" regex=".+/([^/]+)\.(XLF|xlf)">
<xsl:matching-substring>
<xsl:variable name="COMMON" select="regex-group(1)"/>
<xsl:value-of select="$COMMON" /> <!-- Creating?? -->
</xsl:matching-substring>
</xsl:analyze-string>

I think you want
<xsl:variable name="common">
<xsl:analyze-string select="$srcfilename" regex=".+/([^/]+)\.(XLF|xlf)">
<xsl:matching-substring>
<xsl:value-of select="regex-group(1)"/>
</xsl:matching-substring>
</xsl:analyze-string>
</xsl:variable>
to store the matched group in the variable named common.


Then you can use that variable in e.g.

<xsl:variable name="newfilename"
select="concat('output1/',$COMMON,_,@target-language,'.xlf')" />

select="concat('output1/', $common, @target_language, '.xlf')"/>




--

	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/

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.