About Arbortext Styler > Document Preview and Publishing > Generating Accessible HTML Output > User Assigned HTML Tags and Attributes
User Assigned HTML Tags and Attributes
Arbortext Styler associates a default HTML tag with each style in the stylesheet, when it is set to generate regular or semantic HTML outputs. The attributes class, style, align, lang, rowspan, and colspan will also be set with default values as needed. You can manually override these default settings, or add other standard tags or attributes, to meet your own requirements. You can also set a value for the id attribute where it is not set by the HTML publishing process. When HTML publishing sets the value of id, this value will take precedence over the user assigned value.
Use the HTML tag property category to assign a non-default HTML tag or attribute for individual elements, contexts, or conditions, or for property sets.
If the stylesheet is set to generate HTML5 output, HTML5 tags will be included in the list of tags presented.
You cannot manually assign an HTML tag to an element given any of the following styles:
Cross Reference
Definition List
Definition List Item
Link Target (block structure)
List Item
Preformatted (block structure)
Table of Contents
No Style
The HTML tag control will be disabled if the selected element is of one of these styles.
Overriding the default HTML tag setting for an element
The procedure below explains how to override the default HTML tag that has been assigned to an element based on its style. The HTML tag will be output for every instance of the element from the document, when the document is published as regular or semantic HTML.
For example, the cite element has the Inline style in your stylesheet. By default it will be associated with the span HTML tag based on its style, when the source document is published to regular or semantic HTML. To specify that cite elements should output the q HTML tag in HTML output, follow the steps below in Arbortext Styler:
1. Select the cite element in the Elements list.
2. Navigate to the HTML tag property category.
3. Select the HTML output type for which the setting should apply from the Outputs to edit field, if applicable.
4. From the HTML tag drop down list, select q. You have now associated the q HTML tag with the cite element. As it is an explicit setting, note that the title of the drop down list is now bold and blue.
When you publish regular or semantic HTML, you will see a q tag output for every instance of a cite element in your source document.
Bear these general rules in mind when configuring HTML tags:
If you assign the HTML tag (no tag) to an element, there will be no styling for that context in output. It is the equivalent of proving the No Style style.
Configured tags may be ignored in the publishing process if they are not applicable to the element style they are associated with. This is most likely to occur when configuring tags for property sets, where they could be associated with elements of any number of styles. Also, for some elements, a different tag is applied depending on whether the element is of a block or inline structure. Depending on how the structure is resolved, the assigned tag may or may not applicable.
Assigning an attribute to an HTML tag
The procedure below shows how to add an HTML attribute to the HTML tag output for a context when published to HTML output. You will also specify an explicit value for the HTML attribute in output.
For example, ph elements in your source document are styled as Inline (inline structure), which by default outputs a span tag in HTML output. You want to ensure that the content of these ph elements are presented in right to left reading order in HTML output, if their content is in Japanese. The presence of Japanese content is identified by the inclusion of the xml:lang ="ja" attribute on the original ph element. Use the steps below to output the HTML attribute dir on the span HTML tag output for the ph element with Japanese content, and give the attribute the value rtl.
1. Select the relevant context of ph in the Elements list, for example with the condition ph everywhere, if attribute "xml:lang" = "ja".
2. Navigate to the HTML tag property category.
3. Note the HTML tag the context is set to output, for example span.
4. Click Add to open the HTML Attribute dialog box.
5. From the HTML attribute drop down list, select dir. You will see that the Synchronize with PDF attribute box is not checked, since there is no automatic equivalent attribute for a PDF tag.
6. In the Value field, select the Text option.
7. In the Text field, enter rtl.
8. Click OK to exit the dialog box. You will see that the HTML attribute setting is listed in the Attributes table of the HTML tag category. Arbortext Styler has escaped the text in the Value field, to provide a valid XPath expression for your setting.
When you publish tagged HTML, you will see a span dir=”rtl” tag output for every instance of the selected context of ph in your source document.
Validation of HTML output when configuring HTML tagging
Arbortext Styler is not able to assess whether HTML tagging configured for a document will result in valid HTML output. It is generally acceptable to use invalid HTML, for example it will display without problem in a browser. If the final HTML output needs to be parsed, or used in an application that will only accept valid HTML, it is the stylesheet developer’s responsibility to ensure the required configuration and testing is carried out. Particular care must be taken in these cases:
Selecting the Generate semantic HTML/XHTML stylesheet property increases the chances of the output HTML being invalid. The p tag output for paragraph elements has restrictions in HTML, for example it cannot contain nested p tags, or ul or ol tags.
Assigning non-default tags to elements may provide an invalid hierarchy.