Altova Mailing List Archives


Re: Iterate thru text nodes, finding total string-length, Then trim to only 240 char in total for output

From: "Dimitre Novatchev" <dimitren@---.---.-->
To: NULL
Date: 5/7/2005 9:04:00 PM
substring(/, 1, 240)


Cheers,
Dimitre Novatchev

"Mary Mormann" <mmormann@t...> wrote in message 
news:%23n%23LtNoUFHA.2136@T......
> Hello,
> I have a problem I am trying to solve which I hope someone can help. I 
> have
> the below xml data. I want to review the combined length and then
> make sure when I transform the data to a .txt file that only 240char of 
> the
> combined TextLine data is written to the output.
>
> I have found that I can get the total length of the TextLine data with the
> string-length() function.
> <xsl:variable name="lengthtest" select="."></xsl:variable>
>
> Length is:<xsl:value-of select="string-length($lengthtest)"/>
>
>
> But am having trouble triming the TextLine data to output only 240 char in
> Total for all Mark Packages. I tried sub-string(var,1,240) but it is only
> trimming each line_no's text. Can someone help point me in the correct
> direction?
>
>
> <Mark_Packages>
> <TextLine line_no="1">Let&apos;s see how long this will work with line
> number one and if I need to see how long this one is to strip off part of
> the data.</TextLine>
> <TextLine line_no="2">Then I am on Line #2 now and I want to see what the
> length is here. I keep typing and this should be a good test</TextLine>
> <TextLine line_no="3">So then I am</TextLine>
> <TextLine line_no="4"> on Line 3 and I keep typing, now I will
> stop.</TextLine>
> </Mark_Packages>
>
> Thanks,
> Mary
>
> 


Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.