• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

searching and making bold different text in an xml element

 
Christian Nash
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic