[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Unable to indent text in text output -- SOLVED
Hi Aankhen, Woohoo! I figured it out. solution below. <snip> >> >> Here’s my xsl file: >> ------ >> <?xml version='1.0' encoding="utf-8"?> >> <xsl:stylesheet >> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >> xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0"> >> >> <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"/> >> >> <xsl:template match="para[@role = 'box']"> >> <xsl:text> >> </xsl:text> >> <xsl:apply-templates/> >> >> </xsl:template> >> ------ > > I don’t see any indentation here; there’s just a newline within the > ‘xsl:text’ element. BTW, you don’t need to declare the ‘fo’ namespace > unless you’re using it. Oops. Copy and paste error. Sorry about that. Thanks on the 'fo'. I've removed it. <snip> > > Are you sure that this is a DocBook thing that you’re talking about? > It sounds to me like you’re referring to the way HTML collapses > whitespace: outside of the ‘pre’ element, any sequence of whitespace > characters is rendered as a single space, while any leading/trailing > whitespace is trimmed.[1] You have a few options for preserving > whitespace: > > 1. The ‘pre’ element, which will render all whitespace exactly as it > appears in the source. It will also use a monospaced font and only > break lines where you break them in the source, so it’s not very > well-suited for your needs. > 2. Non-breaking spaces ( in HTML,  or  in any > SGML-derived language), which are never collapsed by the browser. > Something like “ ” will be rendered as “ ”. > You could make every space a non-breaking space when you’re trying to > maintain a layout, but that would lead to unfortunate consequences > since, as the name indicates, line breaks are not allowed there. > 3. CSS: set the ‘para.propagates.style’ parameter to ‘1’ so that the > resultant HTML paragraphs have ‘box’ for their class names, then add > whatever indentation or other styling you’d like to your CSS, such as: > > .box { margin-left: 0.5em; } For html output I do #3 already. and yes, it works quite well. :) Yes, the whitespace was being collapsed. <xsl:text disable-output-escaping="yes"> was what I needed to do. Here's my entire xls file: ------ <?xml version='1.0' encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"/> <xsl:template match="para[@role = 'box']"> <xsl:text disable-output-escaping="yes">     </xsl:text> <xsl:apply-templates/> <xsl:text disable-output-escaping="yes"><br></xsl:text> </xsl:template> </xsl:stylesheet> ------ I've been trying to figure that out for, well, longer than I want to admit. Thank you very much!!!!!!!!! Matt
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]