Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="ISO-8859-1"?>
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method="html" indent="yes"/>
- <xsl:template match="Nodes/Node">
- <xsl:apply-templates>
- <xsl:sort select="substring-after(@name,' ')" data-type="number"/>
- </xsl:apply-templates>
- </xsl:template>
- <xsl:variable name="openTag">
- <![CDATA[
- <div>
- ]]>
- </xsl:variable>
- <xsl:variable name="closeTag">
- <![CDATA[
- </div>
- ]]>
- </xsl:variable>
- <xsl:template match="Nodes/Node/Node[not(@name='units' or @name='child data' or @name='stack')]">
- <html>
- <head>
- <style type="text/css">
- body {
- font-size: 14px;
- font-family: verdana;
- background-color: white;
- }
- .root {
- padding: 0px 0px 2px 0px;
- }
- .root div {
- padding: 0px 0px 0px 0px;
- margin-left: 3em;
- }
- </style>
- </head>
- <body>
- <!--Choose the appropriate color for the log-->
- <xsl:variable name="txtcolor">
- <xsl:variable name="colorcode" select="Prp[@name = 'type']/@value"/>
- <xsl:choose>
- <xsl:when test="$colorcode = '3'">red</xsl:when>
- <xsl:when test="$colorcode = '0'">green</xsl:when>
- <xsl:otherwise>blue</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="ownerid" select="Prp[@name='owner id']/@value" />
- <xsl:variable name="nextownerid" select="preceding-sibling::Node[1]/Prp[@name='owner id']/@value"/>
- <!--Format the message to be displayed-->
- <xsl:variable name="LogText">
- <font color="{$txtcolor}">
- <xsl:value-of select="Prp[@name='message']/@value"/>
- </font>
- </xsl:variable>
- <!--Remarks are added if any-->
- <xsl:variable name="Remarks">
- <xsl:if test="string-length(Prp[@name = 'remarks']/@value) > 1">
- <br/>
- <span style="margin-left: 2em">
- <img src="./info.png"></img> 
- <xsl:value-of select="Prp[@name = 'remarks']/@value"/>
- </span>
- </xsl:if>
- </xsl:variable>
- <!--Choose image to display-->
- <xsl:variable name="Image">
- <xsl:choose>
- <xsl:when test="$txtcolor = 'green'">
- <img src="./pass.png"></img>
- </xsl:when>
- <xsl:when test="$txtcolor = 'red'">
- <img src="./fail.png"></img>
- </xsl:when>
- <xsl:when test="$txtcolor = 'yellow'">
- <img src="./fail.png"></img>
- </xsl:when>
- <xsl:otherwise>
- <img src="./info.png"></img>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!--Display the messages with indentation-->
- <div class="root">
- <xsl:choose>
- <xsl:when test="$ownerid < $nextownerid">
- <xsl:value-of select="$openTag" disable-output-escaping="yes"/>
- <xsl:copy-of select="$Image"/> 
- <b>
- <xsl:copy-of select="$LogText"/>
- </b>
- <xsl:copy-of select="$Remarks"/>
- </xsl:when>
- <xsl:when test="$ownerid > $nextownerid">
- <xsl:value-of select="$openTag" disable-output-escaping="yes"/>
- <xsl:copy-of select="$Image"/> 
- <xsl:copy-of select="$LogText"/>
- <xsl:copy-of select="$Remarks"/>
- <xsl:value-of select="$closeTag" disable-output-escaping="yes"/>
- <xsl:value-of select="$closeTag" disable-output-escaping="yes"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$openTag" disable-output-escaping="yes"/>
- <xsl:copy-of select="$Image"/> 
- <xsl:copy-of select="$LogText"/>
- <xsl:copy-of select="$Remarks"/>
- <xsl:value-of select="$closeTag" disable-output-escaping="yes"/>
- </xsl:otherwise>
- </xsl:choose>
- </div>
- </body>
- </html>
- </xsl:template>
- </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement