xsl-list
[Top] [All Lists]

Re: [xsl] concat with unspecific length

2012-06-18 09:52:24
Sorry your function works fine!!! My mistake wa I overlooked..
Thanks
BR
hh

--- henry human <henry_human(_at_)yahoo(_dot_)de> schrieb am Mo, 18.6.2012:

Von: henry human <henry_human(_at_)yahoo(_dot_)de>
Betreff: Re: [xsl] concat with unspecific length
An: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Datum: Montag, 18. Juni, 2012 16:29 Uhr
hi Ken 
For this sample I had your concat works correctly but if the
field one(Field1) is less than 10 characters long  the
result is not incorrect.
The Fields must start ever at the same columns(in both
samples bellow):

wrong result
  2000090691 0010 2000090690 0010 //xml1.Field1 has
length 10(2000090691) 
  TP000001 0010 2000090229 0010   //
xml2.Field1 has length 8(TP000001)
  
Correct result 
  2000090691 0010 2000090690 0010   
  TP000001   0010 2000090229 0010 

BR


--- G. Ken Holman <gkholman(_at_)CraneSoftwrights(_dot_)com>
schrieb am Mo, 18.6.2012:

Von: G. Ken Holman <gkholman(_at_)CraneSoftwrights(_dot_)com>
Betreff: Re: [xsl] concat with unspecific length
An: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com,
"xslforum xslforum" <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Datum: Montag, 18. Juni, 2012 15:50 Uhr
At 2012-06-18 14:39 +0100, henry
human wrote:
Hello
I have following xml bellow and want to concat
together
as here:
Field1 [from position 1, length varies] + " "
[until
position 11] +
Field2 [from position 12] + " " [until position
16]+
Field3 [from 
position 17, length always 10] +
" " [until position 27] + Field4


Input
<Field1>2000090691</Field1>

<Field2>0010</Field2>

<Field3>2000090690</Field3>

<Field4>0010</Field14>

Pad each field with spaces and then take what you
need:

concat(
substring(concat(Field1,'       
   '),1,11),
substring(concat(Field2,'    '),1,5),
substring(concat(Field3,'         
'),1,10),
Field4
)

I hope this helps.

. . . . . . . . . . . Ken

--
Public XSLT, XSL-FO, UBL and code list classes in
Europe --
Oct 2012
Contact us for world-wide XML consulting and
instructor-led
training
Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm
Crane Softwrights Ltd.         
  http://www.CraneSoftwrights.com/s/
G. Ken Holman           
       mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


<Prev in Thread] Current Thread [Next in Thread>