PDA

View Full Version : xsl help!!


dunbshy
11-11-2005, 06:06 PM
i have a xml looks like this
(?xml version="1.0" encoding="utf-8"?)
(?xml-stylesheet type="text/xsl" href="style.xsl"?)

(EventLog)
(Log Date="11/6/2005")
(Event)11:50:57 PM : Start Monitoring Machine: dunbshy(/Event)
(Event)11:53:54 PM : System is Successfully Loaded(/Event)
(Event)11:53:55 PM : Start Monitoring Machine: dunbshy(/Event)
(/Log)
(Log Date="11/7/2005")
(Event)12:15:33 AM : System is Successfully Loaded(/Event)
(/Log)
(/EventLog)

how do i use xsl to put all those event into a table according the it's Log Date? something liket this:

Date = 11/6/2005
11:50:57 PM : Start Monitoring Machine: dunbshy
11:53:54 PM : System is Successfully Loaded
11:53:55 PM : Start Monitoring Machine: dunbshy


Date = 11/7/2005
12:15:33 AM : System is Successfully Loaded

KC-Luck
11-12-2005, 04:26 AM
see if this helps you?
you must remove the space between the & and # though..
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="Log">
<xsl:text>Date = </xsl:text><xsl:value-of select="@Date"/>
<xsl:text>& #13;</xsl:text>
<xsl:apply-templates/>
<xsl:text>& #13;</xsl:text>
</xsl:template>

<xsl:template match="Event">
<xsl:value-of select="text()"/>
<xsl:text>& #13;</xsl:text>
</xsl:template>

</xsl:stylesheet>

dunbshy
11-12-2005, 07:56 PM
thank you very much.. it works fine!!:thumbsup: :thumbsup: :thumbsup: