Hi all,
I've face this problem myself, in particular with the <a> element and xhtml output. The trick is to use pseudoclasses so your rule only applies only to links and not to anchors:

a:link    {
    color: #00589E;
    }

In fact, I think it was someone on this list that clued me into that :-)

Using xhtml output, you might also run into formatting problems if users accidentally include empty tags like <literal/> or <emphasis role="bold"/>. For that you might have a schematron rule warn them or have a preprocessing xslt prune the empty element or break the build with an informative error message.

David

On 03/04/2011 10:02 AM, Kasun Gajasinghe wrote:
Hi Peter,

On Fri, Mar 4, 2011 at 8:54 PM, Peter Desjardins <peter.desjardins.us <http://peter.desjardins.us>@gmail.com <http://gmail.com>> wrote:

    Hi. I'm generating webhelp output using the excellent contribution
    from Kasun and David
    (http://www.thingbag.net/docbook/gsoc2010/doc/content/ch01.html). It
    uses the XHTML output stylesheets.

    The empty anchor tags in my webhelp output have been collapsed into
    single empty element tags like this:

    <a id="foo" />

    This makes it hard to style links using CSS because some browsers
    don't think the <a /> element has ended and they apply anchor styles
    to all the following content (until an anchor element with a separate
    closing tag is encountered). This doesn't happen for HTML output; in
    HTML output empty anchor elements have separate closing tags like <a
    id="anchorname"></a>.

    I use Saxon 6.5.5 and I found this posting that indicates separate
    closing tags are controlled by the output method:

    http://p2p.wrox.com/xslt/57175-saxon-prevent-closing-empty-elements.html

    The webhelp.xsl file in the DocBook webhelp distribution already sets
    the output method to HTML but I still see <a id="something" /> in the
    resulting XHTML. I'm not sure it's possible to convince Saxon to use
    separate closing tags for empty elements in XHTML. Is anyone able to
    generate XHTML with separate closing tags using Saxon?


We faced the same problem when we included the <script> tag too, since it too has an empty tag when including the JS src. We circumvented this issue by adding a xsl comment like this.

<script type="text/javascript" src="search/htmlFileList.js">
<xsl:comment>some comment</xsl:comment>
</script>

May be this is not a solution for your usecase, but with this you can get something like <a id="anchorname"><!--some comment--></a>.

    I altered webhelp.xsl from the webhelp distribution so that it imports
    from the HTML directory instead of XHTML in DocBook XSL. Now my anchor
    elements have separate closing tags and the resulting webhelp seems to
    work properly. Why was XHTML chosen for webhelp? Will switching to
    HTML cause problems that I haven't encountered yet?


The main issue with HTML is with the html-search feature. To properly retrieve the content text excluding the html-tags, the html files should be in a proper format. Strict XML is the standard way for this. That's the concern here. I haven't encountered any other major issue in switching to html!

Looking at your mail, I'm assume you are switching from html to xhtml, right? If so, have you encountered any concerns that needs some major effort? If so, tell us about it, we'll see about the possibility of supporting to html format too.

Thanks for the compliments Peter! :)

--Kasun

--
~~~*******'''''''''''''*******~~~
Kasun Gajasinghe,
University of Moratuwa,
Sri Lanka.
Blog: http://kasunbg.blogspot.com
Twitter: http://twitter.com/kasunbg

Reply via email to