Customized hrefs

You may need to customize the href attributes generated in the HTML output beyond what you can do with stylesheet parameters. For example, your hrefs may require a different form for a help system, or for an HTTP server that remaps hrefs.

If you need complete control of generated hrefs, then consider customizing the template named href.target. That template has two input parameters: context is the element containing the link source, and target is the element that is the destination of the link. The output of the template depends on whether or not you are using the chunking stylesheet.

There are two versions of the href.target template:

Customizing the non-chunked version is relatively easy. Customing the chunking version requires more care because it does so much more, and because it uses several other templates. Depending on what kind of changes you need to make to hrefs, you might need to trace through the sequence of templates to see where best to apply your changes.

Note

When you customize templates from the chunking stylesheet modules, be sure to put them in the customization layer that handles chunking behavior, as described in the section “Chunking customization”.