Hi,
The directory in the longdesc attribute of the an <img> element comes from 
either a dbhtml dir processing instruction if the mediaobject has one, or the 
base.dir param.  

The W3C designates the longdesc attribute as a URL, which means it should be 
relative to the HTML file that contains it.  Using either the dbhtml dir or the 
base.dir in that attribute is not correct, because then the link path from the 
HTML file (which is in base.dir) would be wrong.  So I consider this a bug in 
the stylesheet.

Like you said, it doesn't seem to matter much, because the <a href> link to the 
actual long description file is correctly constructed relative the the HTML 
file.  And this W3C page:

http://www.w3schools.com/tags/att_img_longdesc.asp

says "Tip: The longdesc attribute is so poorly supported that it should not be 
used. To offer a long description of an image, simply create a link (that is 
visible to anyone) to a page with the description."

The HTML5 spec appears to have dropped the longdesc attribute entirely.  Since 
DocBook XSL generates a visible link, I'm tempted to drop support for this 
attribute in the stylesheets rather than fix it since it appears to be useless. 
 Any objections?

Bob Stayton
Sagehill Enterprises
[email protected]


  ----- Original Message ----- 
  From: Mark Craig 
  To: [email protected] 
  Sent: Friday, March 16, 2012 2:59 AM
  Subject: [docbook-apps] Generate relative longdesc on <img>?


  Hello,


  What HTML customization serves to get relative paths in the longdesc 
attribute on img elements?


  The longdesc links and pages are fine, so it's not something noticeable when 
browsing. But img elements in HTML are coming out with absolute paths in 
longdesc attributes.


  For example:


  <img src="images/standalone-repl.png" 
longdesc="/opt/jenkins/.jenkins/jobs/OpenDJ Community Site (core 
docs)/workspace/target/docbkx/html/admin-guide/figure-standalone-repl.html">


  The corresponding source for the whole media object is:


     <mediaobject xml:id="figure-standalone-repl">
      <alt>Dedicated servers versus consolidated instances</alt>
      <imageobject>
       <imagedata fileref="images/standalone-repl.png" format="PNG"/>
      </imageobject>
      <textobject>
       <para>Dedicated servers are suited to environments with large numbers
       of replicas.</para>
      </textobject>
     </mediaobject>


  Regards,
  Mark

Reply via email to