Preparing DITA Source Documents : Using Passthrough outputclass in DITA
 
Using Passthrough outputclass in DITA
You may want to include some kind of HTML or Javascript in your output that would not be generated as normal output. For this example we are going to use a passthrough attribtue on a paragraph tag in DITA. This will create a Passthrough paragraph style that you would switch to Passthrough in the paragraph options tab in ePublisher, for more information, See “Paragraph Styles Options”.
Below is an example of a Javascript alert in HTML using the CDATA attribute
<p outputclass="Passthrough">
<![CDATA[
<div><a href="alert('Yahoo!'">Click Me!</a></div>
]]>
</p>
Once you have entered in the paragraph that contains the passthrough attirbute, re-scan the documennt and make sure that this passthrough paragraph has the “Passthrough” option enabled so that the HTML will not be processed.
Depending on the output, for example, browser-based (Dynamic HTML or WebWorks Help 5.0) versus PDF output, you may want to use ditaval filtering to ensure that only the web-based output is getting output. For this instance, you would want to have the following DITA markup
<p outputclass="Passthrough" audience="web">
<![CDATA[
<div><a href="alert('Yahoo!'">Click Me!</a></div>
]]>
</p>
For the PDF output, for example you would want to have the Target override:
Targets\PDF\Adapters\xml\scripts\dita
and the default.ditval information:
<val>
<prop att="audience" val="web" action="exclude" />
</val>
For the Dynamic HTML output you would want to have the Target override:
Targets\Dynamic HTML\Adapters\xml\scripts\dita
and the default.ditval information:
<val>
<prop att="audience" val="web" action="include" />
</val>
Note: Depending on what your Target name and input is like, the information may be different than what is listed above. For more information on Target overrides, See “Creating Target Overrides”.