[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook] publisher class attribute applied to wrong html element?
On Thu, Jul 31, 2003 at 11:07:23AM +0200, Patrick Eisenacher wrote: > Hi, > > playing around with customizing the titlepage of my article, I added > <publisher> to the html titlepage.template.xml, generated a new > titlepage.template.xsl and generated the html target doc with xsltproc. > > The publisher indeed showed up on the titlepage. Next I tried to center > the publisher info via css. Unfortunately only the publishername got > centered, not the address. Looking at the generated html, I realized > that the publisher class attribute is applied to the publishername > paragraph and not to the whole div. > > Is this expected or a bug in the stylesheets? > > publisher ::= > (publishername,address*) > > <div> > <p class="publisher"> > <span class="publishername">Fillmore Labs GmbH<br></span> > </p> > <div class="address"> > <p> > <span class="otheraddr">Triforum C2</span><br> > <span class="street">Frankfurter Straße 233</span><br> > </p> > </div> > </div> > > I'm using xsl stylesheets v1.61.3 > > Using libxml 20507, libxslt 10030 and libexslt 720 > xsltproc was compiled against libxml 20507, libxslt 10030 and libexslt 720 > libxslt 10030 was compiled against libxml 20507 > libexslt 720 was compiled against libxml 20507 > > Thanks for your feedback, What you are seeing here is unfortunate fallout from a hack to correct for the fact that an HTML <P> cannot contain another <P>. The publisher element starts a <P>, and the address starts another <P>. According to the document structure, the second <P> would be nested inside the first. But that is invalid HTML. So the stylesheet forces the closure of the first <P> and starts the second one. Unfortunately, that loses the connection to the class="publisher", which was on the first <P>. The <div> element in this case is a general wrapper used to insert an attribute set like 'article.titlepage.recto.style'. Here is an example from the generated titlepage.templates.xsl: <xsl:template match="publisher" mode="article.titlepage.recto.auto.mode"> <div xsl:use-attribute-sets="article.titlepage.recto.style"> <xsl:apply-templates select="." mode="article.titlepage.recto.mode"/> </div> </xsl:template> The stylesheet relies on the internal apply-templates to supply the class attribute. It does so in this case, but then gets unwound for the address. As a workaroudn, you could put something like this in a customization layer to add a classname to the div: <xsl:template match="publisher" mode="article.titlepage.recto.auto.mode"> <div class="publisherdiv" xsl:use-attribute-sets="article.titlepage.recto.style"> <xsl:apply-templates select="." mode="article.titlepage.recto.mode"/> </div> </xsl:template> Then add the CSS center property to the .publisherdiv selector. -- Bob Stayton 400 Encinal Street Publications Architect Santa Cruz, CA 95060 Technical Publications voice: (831) 427-7796 The SCO Group fax: (831) 429-1887 email: bobs@sco.com
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]