[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Collect all the truncated fields in an array
David, thanks for the response. So how do I define "$strings sequence" in my example. Also each of the values in $strings is of different length. ==== So here you want to output two things, a list of strings all truncated to at most $n, and a list of strings that were longer than $n, so if $strings is your sequence of strings and $n is the limit on length result: <xsl:value-of select="for $s in $strings return substring($s,1,$n)"/> these were truncated: <xsl:value-of select="$strings[string-length(.) gt $n]"/> ==== INPUT: <?xml version="1.0" encoding="UTF-8"?> <InputXml> <InputXmlValue1>12</InputXmlValue1> <InputXmlValue2>345</InputXmlValue2> <InputXmlValue3>678</InputXmlValue3> </InputXml> OUTPUT: <?xml version="1.0" encoding="UTF-8"?> <OutputXml> <outputTempVar1>1</outputTempVar1> ==> Truncated. "12" got truncated to "1" <outputVar1>34</outputVar1> ==> Truncated. "345" got truncated to "34" <outputVar2>678</outputVar2> </OutputXml> ----- Original Message ---- From: David Carlisle <davidc@xxxxxxxxx> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Cc: sudheshna iyer <sudheshnaiyer@xxxxxxxxx> Sent: Tue, October 5, 2010 7:53:30 PM Subject: Re: Collect all the truncated fields in an array On 06/10/2010 00:40, sudheshna iyer wrote: > Now I need to collect all the input values that got truncated at the end of the > program in the form of string array. No, you don't. Firstly XSLT doesn't have arrays. As you should have seen by the recent thread it really helps if you try to use XSLT terms for things. Your use of "variable" as a private terminology for "element" which you have continued in this thread more or less ensured that none of the initial answers were relevant to your problem. Secondly as explained when you asked this same question last month. You should not phrase the result in terms of the processing (which fields got truncated) you should phrase it in terms of the input (which fields are long) Since the question is same as before, answer is too: http://markmail.org/message/lcqwtiautdsml7hm David
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|