Subject: Re: [xsl] Another tokenize() question From: James Cummings <James.Cummings@xxxxxxxxxxxxxx> Date: Wed, 11 Aug 2004 11:21:12 +0100 (BST) |
On Wed, 11 Aug 2004, David Carlisle wrote: > regex="(\w|{{[^{{}}]*}})+" Now I know I'm being a pain, but when I use that I get: saxon -o temp2.xml temp.xml addwords2.xsl Error at analyze-string on line 29 of file:addwords2.xsl: net.sf.saxon.type.RegexTranslator$RegexSyntaxException: Error at character 4 in regular expression: expected ()) Transformation failed: Run-time errors were reported If I change it to mike's regex = "[^{{}}]*" I get a single empty <w/> per line. (though no errors) :-) -------- <xsl:template mode="a" match="*"> <xsl:text>{</xsl:text> <xsl:value-of select="name()"/> <xsl:text> </xsl:text> <xsl:value-of select="."/> <xsl:text>}</xsl:text> </xsl:template> <xsl:template match="l/text()"> <xsl:variable name="lines"> <xsl:apply-templates mode="a" /> </xsl:variable> <xsl:analyze-string regex="(\w|{{[^{{}}]*}})+" select="$lines"> <xsl:matching-substring><w><xsl:analyze-string regex="([a-z]*) ([^{{}}])*" select="."> <xsl:matching-substring> <xsl:element name="{regex-group(1)}"> <xsl:value-of select="regex-group(2)"/> </xsl:element> </xsl:matching-substring> <xsl:non-matching-substring> <xsl:value-of select="."/> </xsl:non-matching-substring> </xsl:analyze-string></w></xsl:matching-substring> <xsl:non-matching-substring><xsl:value-of select="."/></xsl:non-matching-substring> </xsl:analyze-string> </xsl:template> --------- > > David > > > ________________________________________________________________________ > This e-mail has been scanned for all viruses by Star Internet. The > service is powered by MessageLabs. For more information on a proactive > anti-virus service working around the clock, around the globe, visit: > http://www.star.net.uk > ________________________________________________________________________ > > --- Dr James Cummings, Oxford Text Archive, University of Oxford James dot Cummings at oucs dot ox dot ac dot uk CALL FOR PAPERS: Digital Medievalism (Kalamazoo) and Early Drama (Leeds) see http://users.ox.ac.uk/~jamesc/cfp.html
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Another tokenize() questi, David Carlisle | Thread | Re: [xsl] Another tokenize() questi, David Carlisle |
RE: [xsl] Another tokenize() questi, Michael Kay | Date | Re: [xsl] Another tokenize() questi, David Carlisle |
Month |