Subject: Re: [xsl] Remove a number at the beginning of some text From: "Graeme Kidd" <coolkidd3@xxxxxxxxxxx> Date: Wed, 7 Jan 2009 21:39:03 -0000 |
This is easier in XSLT 2.0, which supports regular expressions.
But solutions are possible even in 1.0.
A question: will the number ever be inside markup, as in <p><i>1.4</i> Heading</p> or <p><i>1.4 Heading</i></p>? If so, it's trickier.
More questions: does whitespace need to be preserved? will whitespace after the number ever be more than (other than) a single space? Will there ever be whitespace before the number?
Another question: is it fair to define a "number" for these purposes a string of characters that includes only the Arabic numerals 0-9 and periods? What about "1.0.1": is that a number? What about "1,000,000"? "MMIX"?Yes any number from 0-9 with periods e.g. 3.2.1 or 10.1.1
Thanks so far, Graeme
-------------------------------------------------- From: "Wendell Piez" <wapiez@xxxxxxxxxxxxxxxx> Sent: Wednesday, January 07, 2009 7:48 PM To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Subject: Re: [xsl] Remove a number at the beginning of some text
Graeme,
At 10:18 AM 1/7/2009, you wrote:I wanting to remove a number in some text e.g.
< root> < p>1.3 Heading < / p> < root>
Should be:
< root> < p>Heading < / p> < root>
This is easier in XSLT 2.0, which supports regular expressions.
But solutions are possible even in 1.0.
A question: will the number ever be inside markup, as in <p><i>1.4</i> Heading</p> or <p><i>1.4 Heading</i></p>? If so, it's trickier.
More questions: does whitespace need to be preserved? will whitespace after the number ever be more than (other than) a single space? Will there ever be whitespace before the number?
Another question: is it fair to define a "number" for these purposes a string of characters that includes only the Arabic numerals 0-9 and periods? What about "1.0.1": is that a number? What about "1,000,000"? "MMIX"?
In any case, the problem is solvable but this is the sort of thing one needs to know (especially whether you can use XSLT 2.0).
Cheers, Wendell
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Remove a number at the be, Wendell Piez | Thread | Re: [xsl] Remove a number at the be, David Carlisle |
Re: [xsl] how to extract text, tran, Evan Lenz | Date | RE: [xsl] casting sequences, Michael Kay |
Month |