|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: csv to xml converter bug
On 7/10/07, Andrew Welch <andrew.j.welch@xxxxxxxxx> wrote:
<xsl:function name="fn:getTokens" as="xs:string+">
<xsl:param name="str" as="xs:string"/>
<xsl:analyze-string select="concat($str, ',')" regex='(("[^"]*")+|[^,]*),'>
<xsl:matching-substring>
<xsl:sequence select='replace(regex-group(1), "^""|""$|("")""", "$1")'/>
</xsl:matching-substring>
</xsl:analyze-string>
</xsl:function>I think its a neat use of regex-group to capture both sides of the pipe (quoted and unquoted values) but not the trailing comma. Any comments welcome. I've posted the complete transform here: http://andrewjwelch.com/code/xslt/csv/csv-to-xml_v2.html cheers andrew -- http://andrewjwelch.com
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








