OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Subject: DOCBOOK-APPS: first text in HTML list item should not be a para?


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>


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Powered by eList eXpress LLC