Using parentheses in XML Node Attributes

I was having problems with left and right parentheses being inserted into my XML Attributes directly from the database. I found that I could solve the problem by substituting the appropriate XML entities, as follows:

LEFT PAREN <- &#040;
RIGHT PAREN <- &#041;

It was causing this error in my XSLT engine:

XSLT Error (javax.xml.transform.TransformerException): The reference to entity “P” must end with the ‘;’ delimiter.

fun.

Update

The above error was not caused by the parentheses, but rather by the ‘&P’ in the attribute. Changing it to ‘&P’ will fix the problem.

Leave a Reply