[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: Re: DOCBOOK-APPS: first text in HTML list item should not be a para?
On Tue, Dec 11, 2001 at 10:49:32AM -0500, Bradford, Denis wrote: > I'd appreciate comments on a customization I've made - is there a better > way? Should this be a feature request? > > When you convert to any flavor of HTML, all paras in list items are > preserved, like this. > <ul> > <li> > <p>text</p> > <p>text</p> > </li> > <ul> > > The HTML browsers that I've seen do the right thing, suppressing the line > break before the first para in the listitem. But HTML -> text converters do > not do the right thing. So you get a line break between the item number or > bullet, etc., and the text, like this: > > o > text > text > > This is a problem for us because we haven't found a good direct conversion > from XML to text: we need the intermediate HTML format. The author of one > HTML -> text tool insisted to me that the HTML code should be fixed, not the > text converter. So I customized the para template as shown below. Even > though I only need it when the ultimate target format is text, it seems to > have no ill effects on the HTML display either. I wonder if it's the > 'correct' way to code the HTML. > > <xsl:template match="para"> > <xsl:choose> > <xsl:when test="position() = 1 and parent::listitem"> > <xsl:call-template name="firstlistpara"/> > </xsl:when> > <xsl:otherwise> > <xsl:call-template name="notfirstlistpara"/> > </xsl:otherwise> > </xsl:choose> > </xsl:template> > > <xsl:template name="firstlistpara"> > <xsl:call-template name="anchor"> > <xsl:with-param name="node" select="parent::listitem"/> > </xsl:call-template> > > <xsl:call-template name="anchor"/> > <xsl:apply-templates/> > </xsl:template> > > <xsl:template name="notfirstlistpara"> > <p> > <xsl:call-template name="anchor"> > <xsl:with-param name="node" select="parent::listitem"/> > </xsl:call-template> > > <xsl:call-template name="anchor"/> > <xsl:apply-templates/> > </p> > </xsl:template> There is nothing "wrong" with the Docbook generated HTML. I respectfully suggest that the author of the HTML to text tool is wrong. The HTML and XHTML DTDs permit both <p> and #PCDATA as the first child of <li>, and both are in common use. I believe the intended formatting of either coding is to put the mark next to the paragraph. As you say, graphical browsers do this, as do the text browsers lynx and w3m (both of which support -dump). Maybe you should change your text browser. Your customization is a fine kludge to get what you want when the tool doesn't work they way you think it should. 8^) -- Bob Stayton 400 Encinal Street Publications Architect Santa Cruz, CA 95060 Technical Publications voice: (831) 427-7796 Caldera International, Inc. fax: (831) 429-1887 email: bobs@caldera.com
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC