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] | [List Home]


Subject: Re: [docbook-apps] Support for sortable HTML tables?


W. Borgert writes:

> Hi,
> 
> there is a nice little piece of JavaScript to make an HTML table
> sortable: http://kryogenix.org/code/browser/sorttable/ One just
> needs to include the ~6k file in the HTML and set the table
> attribute class="sortable". Furthermore, the table needs to have
> an attribute id with an arbitrary, unique value.
> 
> I would like to use this feature in files generated from DocBook
> sources, but I don't know how to set the class to "sortable"
> (e.g. in case of <informaltable role="sortable">) and to force
> the table to have an "id". Thanks in advance for any hint!

You might be possible to do this with Javascript itself.  Save the stock 
javascript code in a separate file.  Add a body.attributes template to your 
stylesheet:

<xsl:template name="body.attributes">
  <xsl:attribute name="onload">javascript:init()</xsl:attribute>
</xsl:template>

This will add ONLOAD="javascript:init()" to your HTML file's BODY.  Then, 
add a user.head.content template that inserts <script type="text/javascript" 
src="init.js" />, which will put this link into your HTML file's HEAD.  
Put your javascript init() function in init.js, which will use DOM to find 
your table, and set its classname and/or id attributes accordingly.  
Finally, have a second script node in the user.head.content template, that 
points to a file with that stock javascript code.


PGP signature



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