AnFrusch@pepp Posted April 1, 2009 Posted April 1, 2009 (edited) Hello, I'm trying to output a field in HTML (via XSLT) this field data are 'formatted' using some tab (CTRL+TAB) in .fp7 file but the XSLT transformation ignore those TABs treating them as simple space (nbsp; like). Is there any way to show the correct tabulation instead? I tried using translate(filed_text, ' ','& nbsp;') but it didn't work. Edited April 1, 2009 by Guest
comment Posted April 1, 2009 Posted April 1, 2009 What should they be translated to (as there are no tabs in HTML)?
Martin Brändle Posted August 10, 2009 Posted August 10, 2009 Yes, XSLT recognizes the tabs as whitespace. What you could do is the following: Use a calculation field and the FM Substitute function to replace the tab character with the amount of spaces you desire. In the XSLT, output the content of the calculation field with tags around.
comment Posted August 10, 2009 Posted August 10, 2009 You could do the substitution in the XLST stylesheet itself - not much point in using one AND still maintain calculation fields purely for export purposes. Anyway, this thread is 4 months old.
Martin Brändle Posted August 10, 2009 Posted August 10, 2009 Ah yes? Then why did you give not the right answer four months ago?
Martin Brändle Posted August 11, 2009 Posted August 11, 2009 An answer that might help him and others who search and read later this forum. That's why I also answer to posts that are not current. Of course there are many ways (or procedures) for tab substitution. And one can also do with XSLT only, as you mentioned. But the problem here is that one can't use the translate() function, because it replaces only char-by-char, but one needs to substitute tab by several spaces, and that maybe several times. With XSLT 1.0, this can only be done using recursion. That's why I suggested to use FM's Substitute() function (as a quick fix). It's more powerful than several lines of XSLT code for doing the same thing. See XSLT recursion examples on http://www.dpawson.co.uk/xsl/sect2/replace.html
comment Posted August 11, 2009 Posted August 11, 2009 I don't know that replacing the tabs with a number of spaces is "the right answer". When I replied to the OP, the request was "to show the correct tabulation" - and there was no mention of spaces. Even now I am not convinced that spaces are the optimal solution. In any case, I cannot see anything wrong with asking the OP for a clarification, and I think your "rebuke" was misplaced - both in its content and especially in its tone. the problem here is that one can't use the translate() function I didn't say one should use the translate() function. There are a lot of things in XSLT that require recursion - I've never found it to be a problem. Not to mention that this CAN be done without recursion - see for example: http://fmforums.com/forum/showtopic.php?tid/188654/post/315596/#315596
Recommended Posts
This topic is 5583 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now