How to format elements within text using XSL

webmasterbeta

New Member
My XML has an <instructions> element which consists of text; however, partsof the text are enclosed within tags such as <className> or <method>. WhenI output the <instructions> element, I would like to italicize the taggedelements within the text. Can I do this? Here are my efforts so far:The XML<?xml version="1.0"?><?xml-stylesheet type="text/xml" href=http://forums.devx.com/archive/index.php/"LabStyle.xsl"?><labDesc><courseNumber>TCSS341</courseNumber><assignDate>Feb 23, 2001</assignDate><dueDate>March 02, 2001</dueDate><labNo>8</labNo><labName>Temperature GUI</labName><purpose>The purpose of this lab is to experiment with the mechanics of doubly-linkedlists.</purpose><instructions>Write the class <className>DLLNode</className> to represent a node of a doubly-linkedlist; give it the appropriate constructors, setters, and getters.<p/>Write a test class which will create a short doubly-linked list, print it,reverse it, and print the reversed list. Do the printing via a method <method>void printList (DLLNode head)</method>. Do the reversing via a method <method>DLLNodereverseList (DLLNode head)</method>, which returns the head of the reversedlist.<p/>Use some String data for your list that will make reversal easy to verify;e.g., "one", "two", "three", etc.</instructions></labDesc>The XSL<?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="method"><i><xsl:value-of select="."/></i></xsl:template><xsl:template match="className" priority="1.0"><I><xsl:value-of select="."/></I></xsl:template><xsl:template match="labDesc"><HTML><HEAD><TITLE><xsl:value-of select="courseNumber"/> Lab<xsl:value-of select="labNo"/><xsl:value-of select="labName"/></TITLE></HEAD><BODY><CENTER><H2><xsl:value-of select="courseNumber"/><BR/>Lab<xsl:value-of select="labNo"/><BR/><xsl:value-of select="labName"/></H2></CENTER><P><xsl:value-of select="purpose"/></P><P><xsl:value-of select="instructions"/><!----></P><P>This assignment is due at end of lab on<xsl:value-of select="dueDate"/></P></BODY></HTML></xsl:template></xsl:stylesheet>
 
Back
Top