|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
ProgressBar + XSLT
Code:
Hi All,
As mentioned in my first post "Create href in XSLT"
I have a XML file which i am transfering to XHTML using XSLT.
One of the nodes in the XML named:"coverage"
after transforming it to XHTML i represent it in a table.
Is there a way to create a progress bar with the coverage node data? - like if i am in 25% quarter of the bar will be filled.(and a color will be red)
but if 50% appear in the coverage node then half of the bar will be fill and the color will be change to yellow.
Bellow XML example and XSLT file (copy paste to same folder you can see the result)
Thank you from advance for any help you may supply
i.i
XML:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="Style2.xslt"?>
<projects_page>
<project_name name="V5R20">
<status>NoGo</status>
<Plan>20</Plan>
<coverage>12</coverage>
<duedate>48</duedate>
<Mand>10</Mand>
<MF>11</MF>
<P1_Reg>12</P1_Reg>
<projectLink>http://.....</projectLink>
</project_name>
<project_name name="V5R19 SP5">
<status>NoGo</status>
<Plan>70</Plan>
<coverage>50</coverage>
<duedate>30</duedate>
<Mand>10</Mand>
<MF>11</MF>
<P1_Reg>12</P1_Reg>
<projectLink>http://...</projectLink>
</project_name>
</projects_page>
XSLT:
<?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"/>
<xsl:template match="/">
<html>
<body>
<table border="0" width="800" cellpadding="10">
<tr>
<td width="30">
<img src="QA_Pic.jpg" id="pic1" />
</td>
<td width ="770" align="center">
<font size="30" color="CornflowerBlue">
<MARQUEE direction="letf">Running Projects in QA</MARQUEE>
</font>
</td>
</tr>
<tr>
<td colspan="2">
<table width="100%" hight="50%" border="0" align="Left" cellspacing="5">
<tr border="1">
<th width="5%"></th>
<th width="10%">
<font size="3" color="CornflowerBlue" face="Tahoma">Project Name</font>
</th>
<th width="40%">
<font size="3" color="CornflowerBlue" face="Tahoma">Status And Coverage</font>
</th>
<th width="10%">
<font size="3" color="CornflowerBlue" face="Tahoma">Mand.</font>
</th>
<th width="10%">
<font size="3" color="CornflowerBlue" face="Tahoma">MF</font>
</th>
<th width="10%">
<font size="3" color="CornflowerBlue" face="Tahoma">P1 Reg.</font>
</th>
<th width="10%">
<font size="3" color="CornflowerBlue" face="Tahoma">GD</font>
</th>
</tr>
<xsl:for-each select="projects_page/project_name">
<tr align="center">
<td width="70">
<img src="http:...></img>
</td>
<td width="100" align="center">
<font size="3" color="CornflowerBlue" face="Tahoma">
<a>
<xsl:attribute name="href">
<xsl:value-of select="projectLink"/>
</xsl:attribute>
<xsl:value-of select="@name"/>
</a>
</font>
</td>
<td width="350">
<xsl:choose>
<xsl:when test="status='GO'">
<xsl:attribute name="bgcolor">LimeGreen</xsl:attribute>
</xsl:when>
<xsl:when test="status='GO IF'">
<xsl:attribute name="bgcolor">yellow</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="bgcolor">red</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<font size="3" color="black" face="Tahoma">Plan
<xsl:value-of select="Plan"/>% Vs.
</font>
<font size="3" color="black" face="Tahoma">Actual
<xsl:value-of select="coverage"/>%
</font>
</td>
<td width="70" align="center">
<font size="3" color="black" face="Tahoma">
<xsl:value-of select="Mand"/>
</font>
</td>
<td width="70" align="center">
<font size="3" color="black" face="Tahoma">
<xsl:value-of select="MF"/>
</font>
</td>
<td width="70" align="center">
<font size="3" color="black" face="Tahoma">
<xsl:value-of select="P1_Reg"/>
</font>
</td>
<td width="70" align="center">WK
<font size="3" color="black" face="Tahoma">
<xsl:value-of select="duedate"/>
</font>
</td>
</tr>
</xsl:for-each>
<tr>
<td align="center" border="0">
<a href="http:....">
<img src="....."0"></img>
</a>
</td>
<td align="left" border="0">
<a href="...">
<img src="...."0"></img>
</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
|
|
#2
|
|||
|
|||
|
use xsl:for-each for nodeset
Code:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<html>
<xsl:apply-templates select="projects_page"/>
</html>
</xsl:template>
<xsl:template match="projects_page">
<body>
<table>
<xsl:apply-templates select="project_name"/>
</table>
</body>
</xsl:template>
<xsl:template match="project_name">
<tr>
<xsl:apply-templates select="status"/>
<xsl:apply-templates select="Plan"/>
<xsl:apply-templates select="projectLink"/>
</tr>
</xsl:template>
<xsl:template match="status">
<td>
<xsl:value-of select="."/>
</td>
</xsl:template>
<xsl:template match="Plan">
<td>
<xsl:value-of select="."/>
</td>
</xsl:template>
<xsl:template match="projectLink">
<td>
<a>
<xsl:attribute name="href">
<xsl:value-of select="."/>
</xsl:attribute>
gdfasf
</a>
</td>
</xsl:template>
</xsl:stylesheet>
Code:
<?xml version="1.0" encoding="utf-8"?>
<html>
<body>
<table>
<tr>
<td>NoGo</td>
<td>20</td>
<td>
<a href="http://.....">
gdfasf
</a>
</td>
</tr>
<tr>
<td>NoGo</td>
<td>70</td>
<td>
<a href="http://...">
gdfasf
</a>
</td>
</tr>
</table>
</body>
</html>
use css display html http://www.css4you.de/
__________________
Helmut Hagemann Germany wer lesen und google kann ist klar im Vorteil who can read and google is a clear advantage |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > ProgressBar + XSLT |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|