• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

searching and making bold different text in an xml element

 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Beauty is in the eye of the tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic