473,390 Members | 1,140 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,390 software developers and data experts.

XSLT strips bullet tag

I have the following XML:
Expand|Select|Wrap|Line Numbers
  1. <eventsTable>
  2. <eventRec> <dateTime>06/01/2009 21:36:43</dateTime> <rawDateTime>1231277803</rawDateTime> <type>Event</type> <source>GSC</source> <eventId>GSC_USER_CONFIG</eventId> <assAlrm>--</assAlrm> <username>walt</username> <desc>GSC Users<bullet>User Configuration Change</bullet> <bullet> SUBMITTED: walt logged in from IP address</bullet> </desc> </eventRec>
  3. <eventRec> <dateTime>05/01/2009 21:36:43</dateTime> <rawDateTime>1231277803</rawDateTime> <type>Event</type> <source>GSC</source> <eventId>GSC_CONFIG</eventId> <assAlrm>--</assAlrm> <username>walt</username> <desc>System switched to sleep mode</desc> </eventRec>
  4. <eventsTable>
I've developed the following XSL but it seems to strip out the bullets. So I get a displayed desc field like "GSC UsersUser Configuration Change SUBMITTED: walt logged in from IP address " How would I edit my code to include the bullets or even just linebreaks? To get something like:

GSC Users
  • User Configuration Change
  • SUBMITTED: walt logged in from IP address

Expand|Select|Wrap|Line Numbers
  1. <xsl:output method="html"/>
  3. <xsl:template match="/">
  4.   <html>
  5. <body>
  6.   <table id="eventsTable" title="Events Log"><thead>
  7.       <tr>
  8.         <th align="center">TimeStamp</th>
  9.         <th align="center">Type</th>
  10.         <th align="center">Source</th>
  11.         <th align="center">ID</th>
  12.         <th align="center">Associated Alarm</th>
  13.         <th align="center">Username</th>
  14.         <th align="center">Description</th>
  15.       </tr></thead><tbody>
  16.       <xsl:for-each select="eventsTable/eventRec">
  17.         <xsl:sort select="position()" data-type="number" order="descending"/>
  18.         <xsl:if test="position() mod 2 = 1">
  19.           <tr class="even">
  20.             <td align="center"><xsl:value-of select="dateTime"/></td>
  21.             <td><xsl:value-of select="type"/></td>
  22.             <td><xsl:value-of select="source"/></td>
  23.             <td><xsl:value-of select="eventId"/></td>
  24.             <td align="center"><xsl:value-of select="assAlrm"/></td>
  25.             <td align="center"><xsl:value-of select="username"/></td>
  26.             <td><xsl:value-of select="desc"/></td>
  28.           </tr>
  29.         </xsl:if>
  30.         <xsl:if test="position() mod 2 = 0">
  31.           <tr class="odd">
  32.             <td align="center"><xsl:value-of select="dateTime"/></td>
  33.             <td><xsl:value-of select="type"/></td>
  34.             <td><xsl:value-of select="source"/></td>
  35.             <td><xsl:value-of select="eventId"/></td>
  36.             <td align="center"><xsl:value-of select="assAlrm"/></td>
  37.             <td align="center"><xsl:value-of select="username"/></td>
  38.             <td><xsl:value-of select="desc"/></td>
  39.           </tr>  
  40.         </xsl:if>
  42.       </xsl:for-each>
  43.     </tbody></table>
  44.   </body></html>
  45. </xsl:template>
  47. </xsl:stylesheet>
Jan 8 '09 #1
4 6307
2,057 Expert 2GB
This is a little hard because we need to know: Do all bullet nodes start a list? Are there multiple lists in a single description? (hard to deal with). This code uses linebreaks instead.
Expand|Select|Wrap|Line Numbers
  1. <td><xsl:apply-templates select="desc/node()"/></td> 
  3. <xsl:template match="bullet">
  4. <br/>- <xsl:value-of select="."/>
  5. <xsl:if test="not (generate-id(following::node()) = generate-id(following::*)) or position() = last()"> 
  6. <br/>
  7. </xsl:if>
  8. </xsl:template>
Jan 8 '09 #2
Thanks for the quick reply.
Unfortunately when I make that change, it still doesn't display the bullets. But when I play with the xml a little bit and change the <bullet> tags to <li> tags it does display those. That may be the best solution if I don't receive any more suggestions about the bullet tags.
Jan 8 '09 #3
2,057 Expert 2GB
Sorry, edited my reply because I realized <bullet> wasn't a html node.
Jan 8 '09 #4
Heh, yea I was doing the same thing.

The latest code seems to work great. Thanks for the help!
Jan 8 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Nicole Szymanski | last post by:
Hello, I am developing a XML application that uses XSLT in order to transform math lessons written in XML to XHTML. I write TEX equation between math tags, for instance : ...
by: Derek Fountain | last post by:
I've been wading through the O'Reilly XSLT book. All seemed OK and sensible until I got to the "programming" bit - variables, loops, conditions and so on. Do people actually use this stuff for...
by: Francis Hwang | last post by:
Hi, Maybe this is a newbie question, but: Is there a way to output an element's contents -- including contained nodes and free-form text -- without the containing tags? I can imagine that...
by: Peter Schlenker | last post by:
In a navigation panel I try to place a bullet before each entry when the link is hovered at (see http://www.shambhala.de). Mozilla does it like expected, but IE doesn't - any ideas? <a...
by: David Bradbury | last post by:
I may be thinking about this the wrong way, but here goes: In my style sheet I've specified that bullet points should use a specific image rather than just be default bullet points. However, at...
by: Udo Marx | last post by:
Hello to ciwas! Is there a way to change the bullet form, color, etc, of the element <li> under<ul> via css? Any reply will be appreciated. -- Freundliche Gruesse, Netzteil - Udo Marx...
by: Matt | last post by:
I would like to set the "list-style-type" to be a hyphen (-). How can I accomplish this in a style sheet. I tried list-style-type: hyphen; and list-style-type: dash; but neither worked. I also...
by: mike p. | last post by:
I have a docbook xml file, and am using standard docbook 1.61.3 xsl stylesheets to do xhtml transform. Transform works fine when using MSXML. When I try to do the following using asp.net 1.1: ...
by: Foxpointe | last post by:
Given some arbitrary XHTML, I'd like to obtain a 'simplified' XHTML result which strips out a large subset of standard elements and attributes - but not all. The main things I would like to...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.