Subject: Re: [xsl] difficulty using xsl:analyze-string From: "David Carlisle d.p.carlisle@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Wed, 18 Jul 2018 06:54:14 -0000 |
On 18 July 2018 at 07:39, Mukul Gandhi gandhi.mukul@xxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > On Wed, Jul 18, 2018 at 11:35 AM, Liam R. E. Quin liam@xxxxxx > <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: >> >> Remember that \ isn't special in XML or XPath strings, so your string >> contains literal backslashes followed by lower case n. In a regular >> expression \ is special however, so to match a literal backslash-n you >> want \\n insteaf of \n. > > > Thanks, Liam. Your suggestion solves my problem. > > I've some other questions as below, related to xsl:analyze-string, > > 1) The 1st example here, https://www.w3.org/TR/xslt20/#regex-examples > > specifies regex as \n. That probably got me wrong. that example is matching a newline but you wanted to match the two characters \n > > 2) The output I receive, has <br> instead of <br/>. I specified <br/> in my > stylesheet. The output I'm getting might be probably because, I have > <xsl:output method="html"/> in the stylesheet. yes /> is a syntax error in html4 and specified as invalid but ignored in html5 > When I change output spec to following, <xsl:output method="xhtml"/> I get > <br></br> in the output. you would get <br/> for an empty br in the xhtml namespace in xhtml output but you output br in no-namespace. > > When I specify, xsl:output method="xhtml", the following is the complete > output I get, > > <?xml version="1.0" encoding="UTF-8"?><html> > <head> > <title>test</title> > </head> > <body>hello world > <br></br>experimenting with XSLT > <br></br>how are you > </body> > </html> > > Shouldn't an XHTML document begin with something like, > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > > <html xmlns="http://www.w3.org/1999/xhtml"> to get that (which is a very last-century kind of document markup:-) you need to output elements in the http://www.w3.org/1999/xhtml namespace and specify that dtd in the attributes of xsl:output. David
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] difficulty using xsl:anal, Mukul Gandhi gandhi. | Thread | Re: [xsl] difficulty using xsl:anal, Mukul Gandhi gandhi. |
Re: [xsl] difficulty using xsl:anal, Mukul Gandhi gandhi. | Date | Re: [xsl] difficulty using xsl:anal, Mukul Gandhi gandhi. |
Month |