XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 30th, 2004, 07:21 PM
cprovolt cprovolt is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Colorado Springs, CO
Posts: 5 cprovolt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to cprovolt Send a message via Yahoo to cprovolt
Question XSL woes

I am really new to xsl and am working a project that I have to use xsl in.
Not new to programming :-)

I am creating an offline log viewer. The log is in xml and am using xsl stylesheet to convert to html document.

The problem I am having is under log.xml //set/file_open_error I have multiple entries which will change as this is a backup log from veritas.
I need to display all file_open_errors (no matter how many) but am only able to get one to show up in my final product. I have included the portion of xml I am trying to format and the xsl I am now using. (sorry can't give out the whole .xml file don't feel like masking all information!)

Any help would be very much appreciated!
Thanks
Chris

log.xml

Code:
- <set>
<set_resource_name>\\xxx\C$</set_resource_name> 
<tape_name>Family Name: "Media created 1/19/2004 9:00:06 PM"</tape_name> 
- <volume>
<display_volume>Backup of "\\xxx\C$ "</display_volume> 
</volume>
<description>Backup set #8 on storage media #1 Backup set description: "Backup 0031"</description> 
<backup_type>Backup Type: INCREMENTAL - Changed Files - Reset Archive Bit</backup_type> 
<start_time>Backup started on 1/20/2004 at 9:02:47 PM.</start_time> 
<file_open_error>Unable to open the item \\xxx\C$\WINNT\SYSTEM32\Dhcp\dhcp.mdb - skipped.</file_open_error> 
<file_open_error>Unable to open the item \\xxx\C$\WINNT\SYSTEM32\Dhcp\j50.log - skipped.</file_open_error> 
<file_open_error>Unable to open the item \\xxx\C$\WINNT\SYSTEM32\Dhcp\tmp.edb - skipped.</file_open_error> 
<sql_dbcc_group /> 
<end_time>Backup completed on 1/20/2004 at 9:02:54 PM.</end_time> 
- <summary>
<misc>Backed up 12 files in 16 directories.</misc> 
<file_skipped_stat>3 items were skipped.</file_skipped_stat> 
<new_processed_bytes>Processed 7,714,066 bytes in 7 seconds.</new_processed_bytes> 
<vlm_hist_rateformat2>Throughput rate: 63.1 MB/min</vlm_hist_rateformat2> 
</summary>
<filler>----------------------------------------------------------------------</filler> 
</set>


log.xsl
Code:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<html>

<title>
<xsl:value-of select="//header/server"/>
</title>

<body>
<xsl:value-of select="//header/filler"/>
<h2>
<p>
<xsl:value-of select="//header/server"/>
</p>
<p>
<xsl:value-of select="//header/name"/>
</p>
<p>
<xsl:value-of select="//header/start_time"/>
</p>
<p>
<xsl:value-of select="//header/type"/>
</p>
<p>
<xsl:value-of select="//header/log_name"/>
</p>
</h2>

<p>
<xsl:value-of select="//backup/filler"/>
</p>
<table>
<tr>
<xsl:for-each select="//machine">
<h2>
Server Name<xsl:value-of select="machine_name"/>
</h2>
<p><xsl:value-of select="set/tape_name"/></p>
<p><xsl:value-of select="set/volume/display_volume"/></p>
<p><xsl:value-of select="set/description"/></p>
<p><xsl:value-of select="set/backup_type"/></p>
<p><xsl:value-of select="set/start_time"/></p>
<table>
<tr>
<xsl:for-each select="file_open_error">
<xsl:value-of select="."/>
</xsl:for-each>
</tr>
</table>
<p><xsl:value-of select="set/end_time"/></p>
<p><xsl:value-of select="set/summary/misc"/></p>
<p><xsl:value-of select="set/summary/file_skipped_stat"/></p>
<p><xsl:value-of select="set/summary/new_processed_bytes"/></p>
<p><xsl:value-of select="set/summary/vlm_hist_rateformat2"/></p>
<xsl:value-of select="//backup/filler"/> 
</xsl:for-each>

</tr>
</table>

<p>
<xsl:value-of select="//backup/filler"/>
</p>
</body>
</html> 
</xsl:template>
</xsl:stylesheet>

Reply With Quote
  #2  
Old February 1st, 2004, 08:06 PM
fpmurphy fpmurphy is online now
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: USA
Posts: 259 fpmurphy User rank is Corporal (100 - 500 Reputation Level)fpmurphy User rank is Corporal (100 - 500 Reputation Level)fpmurphy User rank is Corporal (100 - 500 Reputation Level)fpmurphy User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 23 h 16 m 51 sec
Reputation Power: 6
I simplified your xml file as follows since it was badly formed:

<set>
<file_open_error>Unable to open the item \\xxx\C$\WINNT\SYSTEM32\Dhcp\dhcp.mdb - skipped.</file_open_error>
<file_open_error>Unable to open the item \\xxx\C$\WINNT\SYSTEM32\Dhcp\j50.log - skipped.</file_open_error>
<file_open_error>Unable to open the item \\xxx\C$\WINNT\SYSTEM32\Dhcp\tmp.edb - skipped.</file_open_error>
<misc>Backed up 12 files in 16 directories.</misc>
</set>

and your sample xsl as follows:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<head></head>
<body>

<h1><xsl:value-of select="//misc"/></h1>

<table>
<xsl:for-each select="//file_open_error">
<tr><td>
<xsl:value-of select="."/>
</td></tr>
</xsl:for-each>
</table>

</body>
</html>
</xsl:template>
</xsl:stylesheet>

The ouput is as follows:

<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-16">
</head>
<body>
<h1>Backed up 12 files in 16 directories.</h1>
<table>
<tr><td>Unable to open the item \\xxx\C$\WINNT\SYSTEM32\Dhcp\dhcp.mdb - skipped.</td></tr>
<tr><td>Unable to open the item \\xxx\C$\WINNT\SYSTEM32\Dhcp\j50.log - skipped.</td></tr>
<tr><td>Unable to open the item \\xxx\C$\WINNT\SYSTEM32\Dhcp\tmp.edb - skipped.</td></tr>
</table>
</body>
</html>

As you can see it includes all the file_open_errors as required.

Enjoy
- F

Reply With Quote
  #3  
Old February 1st, 2004, 09:46 PM
cprovolt cprovolt is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Colorado Springs, CO
Posts: 5 cprovolt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to cprovolt Send a message via Yahoo to cprovolt
Thanks

Thanks that worked very well!!!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > XSL woes


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway