Hi, I have an XML like this:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<?xml-stylesheet type='text/xsl' href='Log.xsl'?>
<root>
<Log Category="2" Level="1">
<Text>Initializing Log system.</Text>
</Log>
<Log Category="3" Level="1">
<Text>Initializing MySQL database system...</Text>
<Action>
<Text>'/etc/Helper.MySQL' is the path to the config file.</Text>
</Action>
</Log>
</root>
I would like to make a xsl that would list all Log tag and within
that element, all actions
But then, I would like just to show the actions when the user click at
the log row
And when it is showed up, it hides when it clicks on it again
I got to list all logs and actions, but the problem now is how to hide
and show the actions
I can do that easily with javascript, but not with xsl
Here is my xsl code by now
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- variables -->
<xsl:variable name='Column_Level'>Level</xsl:variable>
<xsl:variable name='Column_Category'>System</xsl:variable>
<xsl:variable name='Column_Message'></xsl:variable>
<xsl:template name="getLevel">
<xsl:variable name='LevelCod'><xsl:value-of select="@Level"/></xsl:variable>
<td align='left'>
<xsl:choose>
<xsl:when test="$LevelCod = 1">Info</xsl:when>
<xsl:when test="$LevelCod = 2">Warning</xsl:when>
<xsl:when test="$LevelCod = 3">Error</xsl:when>
<xsl:when test="$LevelCod = 4">Crash
Error</xsl:when>
<xsl:otherwise>
<td>UNDEFINED</td>
</xsl:otherwise>
</xsl:choose>
</td>
</xsl:template>
<xsl:template name="getCategory">
<xsl:variable name='CatCod'><xsl:value-of select="@Category"/></xsl:variable>
<td align='right'>
<xsl:choose>
<xsl:when test="$CatCod = 1"><td>Xerces
XML</td></xsl:when>
<xsl:when test="$CatCod =
2"><td>Logs</td></xsl:when>
<xsl:when test="$CatCod =
3"><td>MySQL</td></xsl:when>
<xsl:when test="$CatCod = 4"><td>Shared
Memory</td></xsl:when>
<xsl:when test="$CatCod =
5"><td>Socket</td></xsl:when>
<xsl:when test="$CatCod =
6"><td>Timer</td></xsl:when>
<xsl:when test="$CatCod =
7"><td>Language</td></xsl:when>
<xsl:when test="$CatCod =
8"><td>System</td></xsl:when>
<xsl:when test="$CatCod =
9"><td>Users</td></xsl:when>
<xsl:otherwise>
<td>UNDEFINED</td>
</xsl:otherwise>
</xsl:choose>
</td>
</xsl:template>
<xsl:template match="root">
<html>
<head>
<title>
Logs! xD
</title>
</head>
<style type='text/css'>
body,td,tr,div{
font-Size: 9pt;
font-family: "Courier New", Courier, monospace;
margin:0;
}
</style>
<body>
<table>
<thead>
<tr>
<td align='left'>[</td>
<td
align='left'><xsl:value-of select="$Column_Level"/></td>
<td
align='right'><xsl:value-of select="$Column_Category"/></td>
<td align='right'>]</td>
<td
align='left'><xsl:value-of select="$Column_Message"/></td>
</tr>
</thead>
<xsl:apply-templates>
</xsl:apply-templates>
</table>
</body>
</html>
</xsl:template>
<!--HERE IS THE MAIN PROCCESS -->
<xsl:template match="Log">
<tr>
<td align='left'>[</td>
<xsl:call-template name="getLevel" />
<xsl:call-template name="getCategory" />
<td align='right'>]</td>
<xsl:value-of select="Text"/>
</tr>
<xsl:apply-templates select="Action"/>
</xsl:template>
<xsl:template match="Action">
<tr>
<td colspan='4'></td>
<td><xsl:value-of select="Text"/></td>
</tr>
</xsl:template>
<!--END MAIN PROCCESS -->
</xsl:stylesheet>
Any help please?
thanks
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--