xsl-list
[Top] [All Lists]

[xsl] Sequence of chars not working with analyze-string

2006-05-07 02:07:52
I am trying to parse a text doc using analyze-string. But when I want to retrieve the 30th to 60th chars it ignores the first arg and retrieves the second. For example (.{{30,60}}) returns 60 chars.
Here is the source:  "Daily Appointments.txt"
     Consignee:  FARR WEST - DELI
Start Time Stop Time Load ID Order # Carrier Cases Weight Pallets Cube Vendor Name Load Type

04/01/06 06:00 04/01/06 07:30 300559 PFS* Door:311D Con:0104 StrrmLnCPU HOT 9856065 1,800 36,000 56 1,821PROFESSIONAL FOOD SYSTEMS ¨ ¨ ¨ Load Totals 1,800 36,000 56 1,821

04/01/06 06:00 04/01/06 07:30 300382 DON STOCKLEY TRUCKING Door:317D Con:0104 StrrmLnCPU HOT 9865900 206 2,650 11 253KINGS HAWAIIAN BAKERY ¨ ¨ ¨ 9872940 5 3,780 5 270AMERICAN PIE ¨ ¨ ¨

9877320 290 1,813 2 86SAPUTO CHEESE USA INC ¨ ¨ ¨ 9880590 450 6,831 6 298AMERICAN PIE ¨ ¨ ¨ ¨ ¨ ¨ 9880600 418 4,828 10 347CLAIM JUMPER RETAIL FOODS 9886650 282 3,036 4 145SPECIALTY BRANDS ¨ ¨ ¨

Load Totals 1,651 22,938 38 1,399 04/01/06 06:00 04/01/06 07:30 300166 AFS Door:319D Con:0104 StrrmLnCPU HOT 9873530 630 4,095 6 180LAYTON DAIRY ¨ þ ¨ ¨ þ ¨ 9880740 1,008 6,300 10 297LAYTON DAIRY

Using the following
...
<xsl:for-each select="tokenize(unparsed-text('Daily Appointments.txt'),'\r\n')">
  <xsl:analyze-string select="." regex="(\d{{7}})\s+([0-9,]+)(.{{30,60}})">
  <xsl:matching-substring>
  <load>
  <po><xsl:value-of select="regex-group(1)"/></po>
  <cases><xsl:value-of select="replace(regex-group(2),',','')"/></cases>
  <vendor><xsl:value-of select="regex-group(3)"/></vendor>
  </load>
  </xsl:matching-substring>
  </xsl:analyze-string>
  </xsl:for-each>
...

I am trying to retrieve the PO, cases, and vendor name.

Thanks for the help


--~------------------------------------------------------------------
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>