You are asking an XML/XSLT question, which have better lists to answer this.  However, basically it boils down to:
1. Why are you desiring to color a word?  Something about that word has significance (i.e. an attribute) that your XML source is not properly conveying.
2. The original XML shouldn't have markup to say "this word should be red", but can say things like <important>someword</important>.  The former is XSL-FO information, the latter is descriptive attribute of the content and is likely proper XML markup to add.
3. If you have text that need red highlight and you can programmatically determine that from scanning the text, then you have a simple XML/XLST task using the XSLT string functions.  Consult the XSLT Cookbook from O'Reilly Books for good examples of that kind of processing.
 
Matthew Zaleski


From: Andre Groeneveld [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 09, 2006 11:38 AM
To: [email protected]
Subject: Changing colour inside a line.

Hi all,

 

Is it possible to read a line of text from an XML document and change the font color of a word inside the line, I know that you can do it in XSL:FO, but is there a way of indicating that a words color can change?

 

For example, if the line should look like this:

 

This is a line with red text inside.

 

I can do it with fop by doing something like this:

 

<fo:block font-size="9pt" space-before="0.35cm" font-color=”black”>This is a line with <fo:inline color="red">red</fo:inline> text inside.</fo:block>

 

But I read the line from an xml, so I can’t do it the way mentioned above, is there a way that I can specify through XML that it must change it?

 

Thank,

Reply via email to