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(_at_)nag(_dot_)co(_dot_)uk>
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Cc: sudheshna iyer <sudheshnaiyer(_at_)yahoo(_dot_)com>
Sent: Tue, October 5, 2010 7:53:30 PM
Subject: Re: [xsl] 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
--~------------------------------------------------------------------
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>
--~--