Re: whitespace problem when formating to plain-text
Kevin wrote: > > >John, > >The normalize function will remove leading and trailing whitespace. It is >hard to read your xml but you may have to force spaces where needed using >something like <xsl:text> </xsl:text>. > BTW there isn't any special magic to using the character entity: you can just as well write <xsl:text> </xsl:text>. Its a matter of which you think is clearer, and if the difference is worth the extra typing (the best form of documentation is a comment of course). I have done this kind of thing, and found that blindly adding spaces around either the text elements or the <link> elements ends up giving you spaces you do not want (typically at the beginning and end of sentences or where there is other puctuation). One way to normalize the space at the ends of the text rather than losing it is to: add a character (x say) at the beginning and end of the string use normalize-space on it use substring to remove the first and last character from the result (i.e. the x's you added to begin with) Then if the text starts/ends with white space the result will get one space. You will need to use temporary variables to do this, unless you don't mind repeating the normalize - this is because the substring call needs to know the length of the normalised string. Regards, Trevor Nash -- Traditional training & distance learning, Consultancy by email Melvaig Software Engineering Limited voice: +44 (0) 1445 771 271 email: tcn@xxxxxxxxxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
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