This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Splitting non-delimited string
- From: "Michael Kay" <michael dot h dot kay at ntlworld dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Mon, 31 Dec 2001 14:42:55 -0000
- Subject: RE: [xsl] Splitting non-delimited string
- Reply-to: xsl-list at lists dot mulberrytech dot com
> I have an id that is half numeric and half text. I need to
> split it into
> two ids--one numeric, and one text. The id can be any
> length, and has no
> delimiters.
>
> From:
> <AgencyReportNumber>123ABC</AgencyReportNumber>
If "text" means A-Z, then:
<xsl:variable name="a" select="translate(AgencyReportNumber, 'ABCDE...Z',
'AAAAA...A')"/>
<xsl:variable name="b" select="string-length(substring-before($a, 'A'))"/>
<xsl:variable name="num" select="substring(AgencyReportNumber, 1, $b)"/>
<xsl:variable name="alf" select="substring(AgencyReportNumber, $b+1)"/>
Mike Kay
>
> To:
> <AGENCY-RPT-NO>
> <NUMBER-PORTION>123</NUMBER-PORTION>
> <TEXT-PORTION>ABC</TEXT-PORTION>
> </AGENCY-RPT-NO>
>
> Substring doesn't seem appropriate since there is no
> delimiter and no set
> number of characters. My other thought is to somehow use number
> recursively--could this work? Any advice would be appreciated.
>
> Thanks in advance,
> Allison Denny
>
>
> Allison Denny
> Data Analyst
> 4520 East-West Highway
> Bethesda, MD 20814
>
> LexisNexis
> It's how you know
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list