Re: [xsl] csv to xml converter bug

Subject: Re: [xsl] csv to xml converter bug
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Fri, 13 Jul 2007 11:10:30 +0100
On 7/12/07, iwanttokeepanon <iwanttokeepanon@xxxxxxxxx> wrote:
>   <xsl:analyze-string select="concat($str, ',')" regex='(("[^"]*")+|[^,]*),'>
>     <xsl:matching-substring>
>       <xsl:sequence select='replace(regex-group(1), "^""|""$|("")""", "$1")'/>
>     </xsl:matching-substring>
>   </xsl:analyze-string>

Here you have regex='...' and select='...' ; but your HTML page shows
regex="..." and select="..." ; which is invalid XML given the quotes
in the regular expression.

I had copied the code out of the webpage and saxon won't compile it.
I modified the quotes and all workes perfectly!

Well spotted! Now fixed, thanks.


It's something to be aware of I guess when you are pretty printing XML
- the transform won't know which type of quotes were used in the
input...unless, possibly using a combination of the input as parsed
XML and unparsed-text.

I have been meaning to update Oliver Becker's xml-verbatim.xsl to 2.0,
maybe it would be feasible then... (but probably not too enjoyable to
code!)

http://www2.informatik.hu-berlin.de/~obecker/XSLT/#xmlverbatim

cheers
andrew

--
http://andrewjwelch.com

Current Thread