xsl-list
[Top] [All Lists]

Re: [xsl] csv to xml converter bug

2007-07-13 03:10:46
On 7/12/07, iwanttokeepanon <iwanttokeepanon(_at_)gmail(_dot_)com> 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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>