groads2 Posted May 10, 2013 Share Posted May 10, 2013 (edited) I have this blob of text in on of the xml strings that I am receiving and transforming to html with xsl 1.0. I need to display it with all the white space preserved in a chromium object. I have read as much as someone can read on the subject of using xsl to transform this to html with the whitespace and tried a lot of those suggestions without getting the html to display correctly in the browser window. I have attached the xml. Anyone have a solution? Thanks. Edited January 2, 2014 by groads2 Link to comment Share on other sites More sharing options...
Martin Honnen Posted May 12, 2013 Share Posted May 12, 2013 Well HTML has the "pre" element so write a template that transforms the MessageResponse element into a "pre" element: <xsl:template match="ns5:MessageResponse"> <pre><xsl:value-of select="."/></pre></xsl:template> of course making sure the stylesheet declares xmlns:ns5="https://enroute.com/ctsp/queries/1.0" on the xsl: stylesheet element.Then all you need is to make sure the template is used, the built-in templates should ensure that, if you write your own make sure you use apply-templates e.g. <xsl:template match="/"> <html> <head> <title>Example</title> </head> <body> <xsl:apply-templates/> </body> </html></xsl:template> Link to comment Share on other sites More sharing options...
groads2 Posted May 13, 2013 Author Share Posted May 13, 2013 (edited) /removed Edited January 2, 2014 by groads2 Link to comment Share on other sites More sharing options...
Martin Honnen Posted May 13, 2013 Share Posted May 13, 2013 Well my suggestion is not to try to convert line breaks to "br" elements but instead simply put the text with the line breaks into a HTML "pre" element as then the browser will render line breaks as line breaks and will not collapse white space as it happens in other elements like the "p" element. Link to comment Share on other sites More sharing options...
Recommended Posts
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