Solved

XSL Transformations

Posted on 2011-09-07
4
295 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
Comment Utility
<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
Comment Utility
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
Comment Utility
Hi,

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

Author Comment

by:PMH4514
Comment Utility
thanks!
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This is a how to build your own CSS3 slideshow and when I say CSS3 I mean just CSS with no javascript in sight! There a few examples online of how to do this but most just show you an example without any explanation, others make it more complicat…
As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

743 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

14 Experts available now in Live!

Get 1:1 Help Now