Subject: RE: Refactoring parsing code with XSLT 2.0
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 13 May 2005 09:17:46 +0100
|
> I've used tokenize, and I like it. But it seems to only work
> where you
> can throw away the delimiters.
Yes, xsl:analyze-string is much more powerful for this kind of thing.
Michael Kay
http://www.saxonica.com/
>
> Ex. "a b c" --> "a", "b", "c" (with the spaces gone)
>
> In this case, what I need is
>
> "3.04in" --> "3.04", "in"
>
> So I'd need a regex that hits in the right spot, but matches zero
> characters. I don't think lookaheads are in the spec. At
> least I haven't
> found them. Neither are subexpressions that I can tell.
>
> I still have a feeling that XSLT2 offers some elegant way to
> do this, at
> least more elegant than my current 11-line <xsl:choose>
> construction. Am
> I off-key?
>
> .micah
>
> M. David Peterson wrote:
>
> >Micah,
> >
> >Do you want to potentially keep track of what goes with what... in
> >other words do you want to walk away with a set of elements that have
> >the value, unit short name, and unit long name for example...
> >
> >Actually, no matter what your desired output is in 2.0 this type of
> >functionality is serviced via the tokenize() function
> >
> >
>
> --
> Available for consulting. XForms, web forms, information overload.
> Micah Dubinko mailto:micah@xxxxxxxxxxxx
> Brain Attic, L.L.C. http://brainattic.info
> Yahoo IM: mdubinko +1 623 298 5172
> Learn XForms today: http://xformsinstitute.com
| Current Thread |
|
Michael Kay - 13 May 2005 08:16:00 -0000
|
|