This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Splitting a String Request
- From: Mike Ferrando <mikeferrando at yahoo dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Tue, 22 Jan 2002 15:09:52 -0800 (PST)
- Subject: [xsl] Splitting a String Request
- Reply-to: xsl-list at lists dot mulberrytech dot com
Dear Friends,
Could someone give me the syntax for splitting a string?
What I have presently is:
<PERSNAME ENCODINGANALOG="100$a" ROLE="cmp">Abbott, Frank</PERSNAME>
What I would like is:
<PERSNAME ENCODINGANALOG="100$a" ROLE="cmp" NORMAL="Abbott,
Frank">Frank Abbott</PERSNAME>
It is possible that there might be an inverted title in these names:
(Mrs.; Miss; Sir; Mme.; Lady)
<PERSNAME ENCODINGANALOG="700$a" ROLE="lyr">Shacklock, C. L.,
Mrs.</PERSNAME>
What I would like would be:
<PERSNAME ENCODINGANALOG="700$a" ROLE="lyr" NORMAL="Shacklock, C. L.,
Mrs.">C. L. Shacklock, Mrs.</PERSNAME>
The best thing to do might be to first search out all the names with
titles and make a list. Run the xsl style sheet and then go back and
edit or correct this small group of names. That might make the whole
style sheet less complicated.
I was thinking that it would be nice if I could retain the UTF-8
coding (André instead of the usual output of é). Would it
be a problem to use copy-of instead of value-of, since I am going to
split a string?
Thanks,
Mike Ferrando
Washington, DC
--- Mike Ferrando <mikeferrando@yahoo.com> wrote:
> --- Michael Kay <michael.h.kay@ntlworld.com> wrote:
> > > I would like to select all names that have initials not
> seperated
> > by
> > > a space. Such as:
> > >
> > > A.A. Peters
> >
> > You mean, all strings containing a dot followed immediately by a
> > capital
> > letter?
> >
> > Then try:
> >
> > test="contains(translate($s, 'ABCDE...Z', 'A'), '.A')"
>
> Mike,
> I found an expression for exactly what I was looking for in your
> book. 1st edition p. 514 bottom of the page under Substring.
>
> Now my xsl reads like this:
>
> <xsl:variable name="qq">.</xsl:variable>
> <xsl:for-each select="//C03//CORPNAME">
> <xsl:variable name="getit" select="."/>
> <xsl:variable name="pvnum" select="..//@ID"/>
> <xsl:choose>
> <xsl:when test="contains($getit, $qq) and
> substring(substring-after($getit, $qq), 2, 1)=$qq">
> <TR>
> <TD><xsl:value-of select="."/></TD>
> </TR>
> </xsl:when>
> </xsl:choose>
> </xsl:for-each>
>
> I got it and it works. I am a little bleary-eyed (small font!), but
> thanks.
>
> Mike F.
>
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Send FREE video emails in Yahoo! Mail!
> http://promo.yahoo.com/videomail/
>
> XSL-List info and archive:
> http://www.mulberrytech.com/xsl/xsl-list
>
__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list