I'm creating a special text editor.

Now i need to mark different words. For example the verbs in yellow, the nouns in red etc.
I want to do this with XML.

For example the sentence is "This is a sample sentence"
With XML tags this looks like this

With this XML and XSL i want to color the verbs and nouns.
Additionally i want to detect what type of word is selected when the user selects a word.

Does anyone knows how to do this ?