[xsl] How to tokenize a comma-separated CSV record which has a field containing a string that has commas?

Subject: [xsl] How to tokenize a comma-separated CSV record which has a field containing a string that has commas?
From: "Roger L Costello costello@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 4 Aug 2022 18:53:38 -0000
Hi Folks,

I'm stuck.

I want to tokenize this:

airport,AeroPublication/airports/airport,ARPT_IDENT,12,ARPT.TXT,ARPT,

into these 7 tokens:

1. airport
2. AeroPublication/airports/airport
3. ARPT_IDENT
4. 12
5. ARPT.TXT
6. ARPT
7. ''    /* empty string */

And tokenize this:

cycleDate,AeroPublication/airports/airport/cycleDate,CYCLE_DATE,59,ARPT.TXT,A
RPT,"substring($ARPT_row/CYCLE__DATE, 3)"

into these 7 tokens:

1. cycleDate
2. AeroPublication/airports/airport/cycleDate
3. CYCLE_DATE
4. 59
5. ARPT.TXT
6. APRT
7. substring($ARPT_row/CYCLE__DATE, 3)   /* bonus points if you can also
remove the surrounding quote symbols) */

Clearly this isn't the solution:

      tokenize(. ',')

as it erroneously breaks apart the last field (string containing commas).

Suggestions?

/Roger

Current Thread