Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSL to bold text?

Status
Not open for further replies.

jfrost10

Programmer
Jun 3, 2001
2,004
CA
Hey guys,

Is it possible to use xsl to bold some text?

not sure if xsl can do that, or if thats more an fo role (I know fo can do it, but I need some other way)

Thanks,

D
 
I may be missing the point but couldn't you use xsl to output the text within b tags...? --------------------------------

jb
 
indeed. you can format the text with any html tags...
Usage of <span...> blocks is also common...

Be sure that your output method is set to HTML though... [red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro
 
Heh..yeah, you guys are missing something, but its my bad. I should have mentioned that my xsl is passed along with my xml to the apache FOP to be output as a pdf. I was hoping that I could easily bold something that the FOP would understand, but I'm not sure if a <b> tag would work?

Thanks,

Jack
 
Hey guys,

I was able to get it all working. Didn't realize how easy it was to convert HTML to XML, and the changes in my xsl file were minimal to convert the values to something FOP could understand.

Thanks,

Jack

 
So it was something like:
Code:
<fo:inline font-weight=&quot;bold&quot;>this</fo:inline>
:)
 
yes, but it was a matter of converting the <STRONG> tag to something my XSL could understand, and then applying the fo:inline font-weight=&quot;bold&quot; to it.

Jack
 
Hey Neil,

Since you seem to know a bit about FOP, let me throw this by you:

Here's my xml:

<Paragraph>
<Line>this has some text</Line><Line>This has text too</Line>
</Paragraph>

now if you were to see this in a textbox, it would actually look like this:
this has some text
This has text too

Do you know how, using FO, that I can tell it to recognize any <Line> element as a carriage return (i.e. as if they had hit enter).

I already have it for the Paragraph blocks, but just trying to figure out how to set it up for the Line blocks.

Thanks,

jack
 
Sorry, I'm more familiar with XSLT, than with XSL-FO. What have you got for the <Paragraph> elements? You could probably do something similar with the <Line> elements?
Sorry I couldn't be more help :-(
 
np man

The solution was Uber-easy (and i'm glad I found it before I did this huge string manipulation code) ;)

Instead of turning the <BR> tags into <Line> tags, i just changed them to <BR/>, which is XML complient. Then, in the fo, i just added this template:

<xsl:template match=&quot;BR&quot;>
<fo:block space-after=&quot;1pt&quot;>
<xsl:apply-templates/>
</fo:block>
</xsl:template>

That will add a new fo block right underneath the previous one, but all the fonts, bolds, underlines, etc. will still be valid accross the paragraphs.

Jack
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top