Saxonica: XSLT and XQuery Processing: Source documents

Source documents

Source documents may be read using the doc() and document() functions in the usual way.

When navigating the HTML DOM, regular elements and attributes are in no namespace, and their names are always written in lower-case regardless of the actual case used in the HTML page.

As well as exposing regular attributes in the DOM tree, Saxon also exposes pseudo-attributes to make available information that is normally exposed only via JavaScript properties rather than as DOM attribute nodes. For example, clicking a checkbox changes the checked property to true or false, but it does not affect the value of the checked attribute. Saxon therefore makes the property available as a pseudo-attribute @prop:checked, where the namespace prefix prop is bound to the namespace URI Moreover, Saxon exposes properties of the style of the element in a similar way: for example the style's font-size property is available as the pseudo-attribute @style:fontSize, where the namespace prefix style is bound to the namespace URI Pseudo-attributes are accessible by explicit name in a path expression, but they are not included in the results when you read all attributes of an element using @*. They are also not copied by xsl:copy. They can be written as well as read, using xsl:attribute, attributes in a literal result element, or ixsl:set-attribute.

When you write a style attribute to the HTML DOM, Saxon parses the value of the attribute and updates the corresponding properties of the style object associated with the DOM element. For example, if you set style="font-size:30px; font-weight:normal" on an element E, Saxon will set to 30px and to normal. (Firefox does this automatically, Internet Explorer does not, so this is designed to improve portability across browsers.)

Note: Style property names specific to a rendering engine are, by convention, prefixed with a '-' hyphen character. A name prefixed in this way is not a valid XML name, and would prevent the XSLT from compiling. You therefore should prepend such a name with the the undersore '_' character which Saxon-CE will recognize and remove when accessing the HTML DOM. For example, when referencing the style property, -webkit-transition, use style:_-webkit-transition.