aspose file tools*
The moose likes XML and Related Technologies and the fly likes searching and making bold different text in an xml element Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "searching and making bold different text in an xml element" Watch "searching and making bold different text in an xml element" New topic
Author

searching and making bold different text in an xml element

Christian Nash
Ranch Hand

Joined: Jan 17, 2006
Posts: 107
Hi,

I have an xml file having certain elements.One of them is the biography element viz. <biography>My name is Christian</biography>. I have a corresponding xsl for this to generate a html format. I wanted to know as to how i can make the different parts of the text inside biography to appear as bold. i.e. i want the biography text to be output as My name is Christian. How can i write a xsl rule to check for multiple occurrences of these words in a paragraph? Will be thankful for any guidance.

Cheers,
Christian
[ August 06, 2007: Message edited by: Christian Nash ]

- Christian
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18987
    
    8

Writing XSLT code to do that sort of thing is fairly complicated at the best of times. But you don't have the best of times because you don't have any rule about how to pick out those "different" parts. You can't write code in any language at all until you have specified the rules that you want to encode.

So: how should we identify the parts of that text?
Christian Nash
Ranch Hand

Joined: Jan 17, 2006
Posts: 107
Hey Paul,

Thanks a lot for the inputs.

I implemented the above in a recursive manner (i made a rule in my xsl file) when I have to search for a particular word in a paragraph and make it bold (I pass the string/word to be boldened as a parameter to this rule). Was wondering if I can do this for some other words in the paragraph too.

Cheers,
Christian
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18987
    
    8

I don't see why not, at least if you have some way of identifying those "other" words. Perhaps you could pass a list of words instead of just one word to your existing recursive template.
Shruthi Babu
Ranch Hand

Joined: May 04, 2007
Posts: 54
I need something like this can you pass the recursive function to me and explain how to use them

I have no idea as how to use it. my condition is I need to display whatever is available in within [test of xslt] test of xslt including the braces should be made bold.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: searching and making bold different text in an xml element