Prefix and suffix generation

In XML documents, the ability to generate prefix and suffix text automatically is very important. For example, a Note element should not actually contain the prefix 'note:', or anything similar, but should only contain the note text itself:

<note>This is a note</note>

Prefix text

To indicate that this text is in fact a note when it is presented, a suitable prefix may be added. CSS is now able to do this using the 'before' pseudo-element, in conjunction with the new 'content' property:

note:before { content: "NOTE: " }

As the default value of the display property is 'inline', the prefix 'NOTE: ' is added to the text content of the Note element:

   NOTE: This is a note

However, explicitly changing this value to ...

Get XML Companion, The, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.