Using javascript with DITA

Hi All,

How to use javascript with DITA

  • We can give 'javascript:URL'  to the 'href' attribute of <xref>,<link> and <lq> elements and it will execute it properly.
  • We tried to execute javascript user defined functions from href attribute but build fails.
  • We added .js files to .dita file resources and tried to refer a function from that file by href attribute.It is also not working.

Before converting the DITA files into html using DITA toolkit,if we want to add JAVASCRIPT functionality which can be later used in html files, how it can be done? Please guide us.

Regards.

 

 

The simple answer is to set the scope attribute on xref to 'external'. A better answer is almost certain to exist, but it depends on what you are trying to accomplish with JavaScript.

Here are two options for customizing HTML outputs:

  1. Use the Ant parameters that allow you to add repetitive content to the head and foot of each HTML file. You can also furnigh your own alternate .css file through ant parameters. Look here for more information.
  2. Use the XSLT override extension point to modify specific templates in the default XSLT transformation for HTML. Look here for more information. 

You can use either or both of these methods. I hope this is of some use. Sorry for the delayed response.

Bob Thomas

Tagsmiths, LLC

XML.org Focus Areas: BPEL | DITA | ebXML | IDtrust | OpenDocument | SAML | UBL | UDDI
OASIS sites: OASIS | Cover Pages | XML.org | AMQP | CGM Open | eGov | Emergency | IDtrust | LegalXML | Open CSA | OSLC | WS-I