Firstly, the database is giving you < rather than < because it doesn't know that the < is intended to be markup, it thinks it is an ordinary character. If at all possible, you should correct the problem at source: some databases allow you to declare that a field holds XML, in which case the < should be recognized as markup and returned as such.
If you can't correct the problem at source, the next best thing is to parse the XML before you process it. Then your application will be able to process <a/> as an element node, rather than having it misrepresented as a sequence of (in this case five) characters.
Note that the < will never remain as is. The normal process is that it is converted to < on input to your application, and is then converted back to < by the serializer. Within your XSLT code, string-length() on this content will return 1, not 4.
You can suppress the conversion to < in the serializer by using disable-output-escaping="yes", thus making it appear as a < markup character to the next process in the pipeline. However, this is a last resort. It only works if the XSLT transformation is serializing its output. It doesn't work if the result tree is passed directly to the next phase of processing as a tree, which happens for example when you run transformations in the Mozilla browser, or with the Microsoft API when you send the transformation result to a DOM.
Michael Kay
http://www.saxonica.com/