[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Remove a number at the beginning of some text

Subject: Re: Remove a number at the beginning of some text
From: "Graeme Kidd" <coolkidd3@xxxxxxxxxxx>
Date: Wed, 7 Jan 2009 21:39:03 -0000
Re:  Remove a number at the beginning of some text
Hi Wendell,

This is easier in XSLT 2.0, which supports regular expressions.

Yes I can use XSLT 2.0 as I am using AltovaXML.exe


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.

No just <p>1.4 Heading</p>


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?

I searched 8 files and none of them had a space before the number i.e. <p> 1.2 Heading</p> but they all had at least one space after the number except for a few anomalies that had more than one.


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

Does that give you a clearer picture of the problem?

Thanks so far,
Graeme

--------------------------------------------------
From: "Wendell Piez" <wapiez@xxxxxxxxxxxxxxxx>
Sent: Wednesday, January 07, 2009 7:48 PM
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re:  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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.