Subject: RE: [xsl] Long string - inserting a space after every 10 characters From: "Michael Kay" <mhk@xxxxxxxxx> Date: Wed, 4 Feb 2004 09:07:42 -0000 |
XPath 2.0 solution: string-join( for $i in 0 to (string-length($s) idiv 10) return substring($s, $i*10+1, $i*10+11), " ") Not tested. Michael Kay > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of > allan.mccluskey@xxxxxxxxxxxxxxxxx > Sent: 04 February 2004 06:59 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] Long string - inserting a space after every 10 > characters > > > Hi, > > Is it possible to insert a space in a string (of unknown > length) after a specified number of characters e.g. after > every 10 characters insert a space?? > > I have an XML element called <name> which can be anywhere > between 1 and 50 characters long. I need to either split it > (by inserting a <BR/> tag) or inserting a space ( ) > after every 10 characters. > > Example1: > <name>Thisisareallyreallylongnamedontyouthink</name> > > Would look like: > Thisisarea<BR/>llyreallyl<BR/>ongnamedon<BR/>tyouthink > > OR / > > Example2 > <name>Thisisanotherexceptionallylongname</name> > > Would loook like: Thisisanot herexcepti onallylong name > > Many, many thanks > Al > > > > > > > > > Important: This e-mail is intended for the use of the > addressee and may contain information that is confidential, > commercially valuable or subject to legal or parliamentary > privilege. If you are not the intended recipient you are > notified that any review, re-transmission, disclosure, use or > dissemination of this communication is strictly prohibited by > several Commonwealth Acts of Parliament. If you have > received this communication in error please notify the sender > immediately and delete all copies of this transmission > together with any attachments. > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Long string - inserting a, Kenny Akridge | Thread | Re: [xsl] Long string - inserting a, Mukul Gandhi |
RE: [xsl] XSLT vs Perl, Michael Kay | Date | RE: [xsl] XSLT vs Perl, Jim Fuller |
Month |