Forum How do I...?

Character escapes

This is an XML question, but what type of escapes do I use within xml attributes?

<p title="This is a title">This is the content</p>

I remember there is some way to use an entity escape to, say, make the attribute have a line break in the middle. I think it's \A. What are these types of escapes called? Or is my memory off? And is this supported in Prince?

I know it works fine in the content: property of any element within Prince (the /A escape, at least).

In XML attribute values you can use character reference &#xA; (or
) to escape line breaks (unescaped line breaks are subject to normalization rules that convert line feeds and carriage return characters to spaces).
For example:
<element attribute="First Line&#xA;Second Line"/>

with CSS
element[attribute]:before {content:attr(attribute);white-space:pre;}

will produce

First Line
Second Line

While code
<element attribute="First Line
Second Line"/>

will be treated as
<element attribute="First Line Second Line"/>

\A escape sequence can be used in CSS (values of content property) but not XML attribute values.