Jump to content

Help me -- making *part* of a value bold...


Guest Disgruntor
 Share

Recommended Posts

Guest Disgruntor

Ok, so I'm new to XSL, so this might be an easy question, or it might be impossible, but I'd like to believe that *anything* is possible.My XML is populated by our database. One of the fields is a footer, that populates an XML element <Footer>. For one particular footer, we want to make part of the sentence bold while the other part remains normal.currently, the XML looks like this:...blah blah...<Footer>Here is some text</Footer>...blah blah...and the XSL parses like so:<fo:block font-size="12pt" space-after="5pt"> <xsl:value-of select="Footer"/></fo:block>I tried to add <b> and </b> around the parts that I want to make bold, but the XSL ends up outputting those tags as text. Is there ANY WAY to take care of this issue? Do you need more information?Thanks.

Link to comment
Share on other sites

Here is one way; this is the xml document:

<Footer>  <paragraph>Here is some text.</paragraph>   <bold>Here is some bold text.</bold></Footer>

and this is the XSL:

<xsl:template match="Footer">  <fo:block font-size="12pt" space-after="5pt">    <xsl:apply-templates select="paragraph"/>    <xsl:apply-templates select="bold"/>  </fo:block></xsl:template><xsl:template match="paragraph">  <p>    <xsl:value-of select="."/>  </p></xsl:template><xsl:template match="bold">  <p>    <b>      <xsl:value-of select="."/>    </b>  </p></xs:template>

Mind you this is not very clean, and there may be some errors in there. Were you to supply us with a link to the entire XML and XSL files this could be tidied up :) .

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...