Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I format text in between xsl:text tags?

I have an xslt sheet with some text similar to below:

<xsl:text>I am some text, and I want to be bold</xsl:text>

I would like some text to be bold, but this doesn't work.

<xsl:text>I am some text, and I want to be <strong>bold<strong></xsl:text>

The deprecated b tag doesn't work either. How do I format text within an xsl:text tag?

like image 469
BrewinBombers Avatar asked Sep 17 '08 01:09

BrewinBombers


People also ask

What is text () in XSLT?

Definition and Usage. The <xsl:text> element is used to write literal text to the output. Tip: This element may contain literal text, entity references, and #PCDATA.

What is Cdata in xsl?

A CDATA element can be used to present formatted data or an XML document on its own. The problem is that the XSLT processor will normally strip any leading and trailing whitespace, as well as carriage returns from an output XML document – unless instructed otherwise…

What is the purpose of terminate attribute in xsl message tag?

The terminate attribute gives you the choice to either quit or continue the processing when an error occurs.

How do I add a new line in XSLT?

Include the attribute Method="text" on the xsl:output tag and include newlines in your literal content in the XSL at the appropriate points. If you prefer to keep the source code of your XSL tidy use the entity &#10; where you want a new line.


2 Answers

Try this:

<fo:inline font-weight="bold"><xsl:text>Bold text</xsl:text></fo:inline>
like image 133
aku Avatar answered Sep 25 '22 04:09

aku


You don't. xsl:text can only contain text nodes and <strong> is an element node, not a string that starts with less-than character; XSLT is about creating node trees, not markup. So, you have to do

<xsl:text>I am some text, and I want to be </xsl:text>
<strong>bold<strong>
<xsl:text> </xsl:text>
like image 31
jelovirt Avatar answered Sep 24 '22 04:09

jelovirt