|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: a sequence of regex-group()
At 2015-10-28 15:20 +0000, Geert Bormans geert@xxxxxxxxxxxxxxxxxxx wrote:
Hi all, Would it not be easier to somehow deal with the current context list? Remember that analyze-string sets position() and last() for a sequence of matched and non-matched strings. T:\>type temp.xsl <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="2.0"> <xsl:template match="/">
<xsl:text>
</xsl:text>
<xsl:analyze-string select="'a b c d e'" regex="\w">
<xsl:matching-substring>
<xsl:value-of select=".,position(),last(),'
'"/>
</xsl:matching-substring>
<xsl:non-matching-substring>
<xsl:value-of select=".,position(),last(),'
'"/>
</xsl:non-matching-substring>
</xsl:analyze-string>
</xsl:template></xsl:stylesheet> T:\>xslt2 temp.xsl temp.xsl <?xml version="1.0" encoding="UTF-8"?> a 1 9 2 9 b 3 9 4 9 c 5 9 6 9 d 7 9 8 9 e 9 9 I haven't looked at it in detail, but could you not determine the group count from the size of the context list? Perhaps not, if you don't know if the first or last is matching or non-matching. I hope this becomes helpful. I am on a conference call and sneaking in this response. . . . . . . . . Ken
|
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
|

Cart








