XML tag, element, and attribute formatting

Note

These guidelines apply also to Extensible Hypertext Markup Language (XHTML), Extensible Stylesheet Language (XSL), Extensible Stylesheet Language for Transformations (XSLT), and XML Path Language (XPath).

Elements vs. tags

An element includes the tags, the attributes, and the content, if any. For example, consider the following:

<xsl:apply-templates
order-by="sort-criteria-list"
select=expression
mode=QName>
</xsl:apply-templates>

In this example, the <xsl:apply-templates> element consists of the start tag (<xsl:apply-templates>); the order-by, select, and mode attributes; and the end tag (</xsl:apply-templates>).

Note that XML can have empty tags, such as <doctitle/> or <elementName att1Name=“att1Value” att2Name=“att2Value”/>. Empty tags have no textual content, whether or not they have attributes.

Capitalization

XML is a case-sensitive language, so be sure to follow the capitalization of the code, unless otherwise noted. Many items are in lowercase, but not all. When in doubt, check with the author.

Element name formatting

Predefined XSL Transformation (XSLT) element names are always placed inside angle brackets. An example is the <xsl:attribute> element.

An element name can be presented in angle brackets if you are specifically referencing an example or code sample. An example is the <schema> element.

When you are working with document type definitions (DTDs) instead of schemas, you may notice that some primary element names appear in all uppercase letters. They should remain styled as such. An example is the DOCTYPE element.

When you are working with schemas instead of DTDs, use bold formatting for schema element names. An example is the ElementType element.

Use regular type for the name of any user-defined element. Examples are an author element and the bookstore element.

Attribute formatting

Capitalize attributes as they appear in the code and use bold formatting. Examples are the xml:space attribute and the STYLE attribute.

Tag and node formatting

In schemas, place tags and nodes inside angle brackets, as shown in the following example. Capitalization should match what the user must type.

the <first> and </last> tags of the <Schema> node

Note

In DTDs, some tags consist of all uppercase letters. An example is the DOCTYPE tag.

Other formatting

Use bold formatting for collections, data types, functions, interfaces, methods, objects, properties, and scopes. For more information, see Document conventions; HTML tag, element, and attribute formatting.

Use bold formatting for namespaces. An example is the BookInfo namespace.

Use italic formatting for parameters. An example is the output-stylesheet parameter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.202.209