Subject: RE: [xsl] Anyway to avoid a syntax error when matching with a regex containing both '" for example ['"](.*?)["'] From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Thu, 8 Oct 2009 22:13:44 +0100 |
In XSLT 2.0 the rule is: * the delimiter of the XML attribute can be escaped as & quot; or & apos; respectively * the delimiter of the string literal can be escaped by doubling it. However, a simpler approach is often to put the regex in a variable: <xsl:variable name="regex" as="xs:string">['"](.*?)["']</xsl:variable> <xsl:value-of select="matches(, $regex)"/> This way, neither quotes nor apostrophes need to be escaped. Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay > -----Original Message----- > From: Alex Muir [mailto:alex.g.muir@xxxxxxxxx] > Sent: 08 October 2009 12:45 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] Anyway to avoid a syntax error when matching > with a regex containing both '" for example ['"](.*?)["'] > > Hi, > > Is there any way to avoid a syntax error with a regex > containing both '" for example ['"](.*?)["'] in the > following select. > > <xsl:value-of select="matches(., > '['"](.*?)["']')"/> > > > Working with Oxygen 10.3, F [Saxon-B 9.1.0.7] I'll get an > XPath syntax error at char 14 on line 44 in {matches(., > '['"](.*?)["']'}: > expected ")", found "<string-literal>" > > > > I'm sure this is an easy question but I wasn't able to find > the right Google search to answer it. > Thanks > -- > > Alex > https://sites.google.com/a/utg.edu.gm/alex
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Anyway to avoid a syntax , Martin Honnen | Thread | [xsl] How to move all Namespace-URL, Ben Stover |
RE: [xsl] Is it possible to modify , Michael Kay | Date | Re: [xsl] Is it possible to modify , pgfearo |
Month |