Solved

XSL Transformations

Posted on 2011-09-07
4
297 Views
Last Modified: 2012-05-12
I'm using XSL and XML to render DB content.  My first attached snippet is the XSL, the 2nd is the CSS values..

I'm using this to render a chat/discussion. It basically gives me what I want like below:

My Name
Date
Comments......

            Your Name
            Date
            Comments......

My Name
Date
Comments......

            Your Name
            Date
            Comments......


etc..

My question is, how do I make "My Name" and "Your Name" fields render in bold?

Thanks

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
	<xsl:template match="item"> 
		<div class="discussion">
		<div class="{./discussion_class}">
			 <xsl:value-of select="./team_member_name"/><br/><xsl:value-of select="./comment_date"/><br/>
			<xsl:value-of select="./comment"/>
		</div>
		</div>
	</xsl:template> 
</xsl:stylesheet>

Open in new window

.discussion{font-size:12px;font-color:#000000;margin:5px;}
.discussion.my_comment{width:85%;color:#687899;margin:5px;float:left;}
.discussion.others_comment{width:85%;color:#DDDDDD;margin:5px;float:right;}

Open in new window

0
Comment
Question by:PMH4514
  • 2
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
eridanix earned 500 total points
ID: 36496200
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
	<xsl:template match="item"> 
		<div class="discussion">
		<div class="{./discussion_class}">
			 <b><xsl:value-of select="./team_member_name"/></b>
                         <br/>
                         <xsl:value-of select="./comment_date"/>
                         <br/>
			<xsl:value-of select="./comment"/>
		</div>
		</div>
	</xsl:template> 
</xsl:stylesheet>

Open in new window

0
 

Author Comment

by:PMH4514
ID: 36496270
ahh, simpler than I expected! I was trying to wrap it with <span> and couldn't get it to work..  then I thought the closing </b> had to instead be <b/>...  Figures I wouldn't try the most obvious. Still pretty new to XSL transformations..

thank you
0
 
LVL 5

Expert Comment

by:eridanix
ID: 36501029
Hi,

this is not about xslt, but about html. In xslt you can use any html tag you want.
0
 

Author Comment

by:PMH4514
ID: 36502220
thanks!
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now