I have a xslt file that fetches data from a xml file and displays them accordingly. Some of the data in the xml file are in lower-case. Is there any way by which I can change it to upper-case inside the xslt while displaying it in the table? my xslt file is as given below:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>VPGate Media Mixer</title>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache, must-revalidate"/>
<meta http-equiv="refresh" content="15"></meta>
<script src="/Common/common.js\" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="style001.css" />
<link rel="stylesheet" type="text/css" href="Grid.Default.css" />
</head>
<body class="WorkArea">
<div class="divSummaryHeader" id="SummaryHeader">
<h1>Media Mixer - VPGate</h1>
<xsl:for-each select="MMDiagnostics/Conference">
<h1>
Media Mixer - <xsl:value-of select="name"/>
</h1>
</xsl:for-each>
</div>
<div class="RadGrid RadGrid_Default" id="SummaryData" style="position:absolute;width:810px;height:510px;overflow:auto">
<table border="0" class="rgMasterTable rgClipCells" cellspacing="0" cellpadding="0" >
<tr>
<input type="button" class="formEditBtn" id="SubBtn" value="Refresh" onclick="window.location=window.location;"/>
</tr>
<tr>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;" colspan="2">Conference Summary</td>
</tr>
<tr>
<td>
<table border="0" class="rgMasterTable rgClipCells" cellspacing="0" cellpadding="0" >
<tr>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Conference Name</td>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Conference ID</td>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Composite Address</td>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Composite Port</td>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Composite Ssrc</td>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">No Of Participants</td>
</tr>
<xsl:if test="MediaMixer!= ''">
<xsl:for-each select="MediaMixer/Conference">
<!--<xsl:sort select="Name"/>-->
<xsl:if test="Name !=''">
<xsl:if test="(position() mod 2 = 0)">
<tr class="rgAltRow SummaryTableDataRow">
<td valign = "top">
<xsl:value-of select="Name"/>
</td>
<td valign = "top">
<xsl:value-of select="ConfId"/>
</td>
<td valign = "top">
<xsl:value-of select="CompositeAddress"/>
</td>
<td valign = "top">
<xsl:value-of select="CompositePort"/>
</td>
<td valign = "top">
<xsl:value-of select="CompositeSsrc"/>
</td>
<td valign = "top">
<xsl:value-of select="NoOfParticipants"/>
</td>
</tr>
</xsl:if>
<xsl:if test="(position() mod 2 = 1)">
<td>
<tr class="rgRow SummaryTableDataRow">
<td valign = "top">
<xsl:value-of select="Name"/>
</td>
<td valign = "top">
<xsl:value-of select="ConfId"/>
</td>
<td valign = "top">
<xsl:value-of select="CompositeAddress"/>
</td>
<td valign = "top">
<xsl:value-of select="CompositePort"/>
</td>
<td valign = "top">
<xsl:value-of select="CompositeSsrc"/>
</td>
<td valign = "top">
<xsl:value-of select="NoOfParticipants"/>
</td>
</tr>
</td>
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:if>
<xsl:if test="MediaMixer = ''">
<td valign = "top">
<xsl:text>No Data </xsl:text>
</td>
</xsl:if>
</table>
</td>
</tr>
</table>
<table border="0" class="rgMasterTable rgClipCells" cellspacing="1" cellpadding="1" >
<tr>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;" colspan="2">Conference Details</td>
</tr>
<tr>
<td>
<table border="0" class="rgMasterTable rgClipCells" cellspacing="0" cellpadding="0" >
<tr>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Conference Name</td>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Conference ID</td>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Participant ID 1</td>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Participant ID 2</td>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Participant Address</td>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Participant Listening Port</td>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">MM Listening Port</td>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">SSRC From Participant</td>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">SSRC From MM</td>
</tr>
<xsl:if test="MediaMixer!= ''">
<xsl:for-each select="MediaMixer/Conference">
<xsl:for-each select="Participant">
<xsl:if test="(position() mod 2 = 0)">
<tr class="rgAltRow SummaryTableDataRow">
<td valign = "top">
<xsl:value-of select="../Name"/>
</td>
<td valign = "top">
<xsl:value-of select="../ConfId"/>
</td>
<td valign = "top">
<xsl:variable name="text" select="'Upper'" />
<xsl:value-of select="translate($text, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')" />
</td>
<td valign = "top">
<xsl:value-of select="ID2"/>
</td>
<td valign = "top">
<xsl:value-of select="ParticipantAddress"/>
</td>
<td valign = "top">
<xsl:value-of select="ParticipantListeningPort"/>
</td>
<td valign = "top">
<xsl:value-of select="MMListeningPort"/>
</td>
<td valign = "top">
<xsl:value-of select="SSRCFromParticipant"/>
</td>
<td valign = "top">
<xsl:value-of select="SSRCFromMM"/>
</td>
</tr>
</xsl:if>
<xsl:if test="(position() mod 2 = 1)">
<td>
<tr class="rgRow SummaryTableDataRow">
<td valign = "top">
<xsl:value-of select="../Name"/>
</td>
<td valign = "top">
<xsl:value-of select="../ConfId"/>
</td>
<td valign = "top">
<xsl:value-of select="ID1"/>
</td>
<td valign = "top">
<xsl:value-of select="ID2"/>
</td>
<td valign = "top">
<xsl:value-of select="ParticipantAddress"/>
</td>
<td valign = "top">
<xsl:value-of select="ParticipantListeningPort"/>
</td>
<td valign = "top">
<xsl:value-of select="MMListeningPort"/>
</td>
<td valign = "top">
<xsl:value-of select="SSRCFromParticipant"/>
</td>
<td valign = "top">
<xsl:value-of select="SSRCFromMM"/>
</td>
</tr>
</td>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</xsl:if>
<xsl:if test="MediaMixer= ''">
<td valign = "top">
<xsl:text>No Data </xsl:text>
</td>
</xsl:if>
</table>
</td>
</tr>
</table>
<div style="display:none">
<iframe id="frameUpdate" name="frameUpdate" width="100%"></iframe>
</div>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Let us assume that I wish to change ID1 to upper-case. How do i do it ?
Add at the top, before <xsl:template match="/">:
<xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" />
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
And your ID1 selector will be probably:
<td valign = "top">
<xsl:value-of select="translate(ID1, $smallcase, $uppercase)" />
</td>
Related
I'm trying to build a table in my email host for a future marketing email and I'm so darn close to finishing it up - but there's one last item that's stumping me. I'm trying to find a way to remove the extra spacing between the bullets - I know the text itself is single spaced like I want, but I don't want there to be double spacing of sorts between text items or bullets. Is there a small bit of code I can add into the below to adjust spacing between bullets to single or perhaps 1.5x?
<table>
<tbody>
<tr>
<td width="55"> </td>
<td style="vertical-align: top"><span style="line-height:1"><img height="30"
src="https://i.postimg.cc/52RGgKNg/63724-MYK-PP-Email-Announcement-02.png
" width="30" /></span></td>
<td width="20"> </td>
<td><span style="line-height:normal"><span style="font:14px arsenal"><span
style="color:#86c8c5">Cruelty Free</span></span>
</span>
</td>
</tr>
<tr>
<td height="20"> </td>
</tr>
<tr>
<td width="55"> </td>
<td style="vertical-align: top"><span style="line-height:1"><img height="30"
src="https://i.postimg.cc/52RGgKNg/63724-MYK-PP-Email-Announcement-02.png
" width="30" /></span></td>
<td width="20"> </td>
<td><span style="line-height:normal"><span style="font:14px arsenal"><span
style="color:#86c8c5">Vegan Friendly</span></span>
</span>
</td>
</tr>
<tr>
<td height="20"> </td>
</tr>
<tr>
<td width="55"> </td>
<td style="vertical-align: top"><span style="line-height:1"><img height="30"
src="https://i.postimg.cc/52RGgKNg/63724-MYK-PP-Email-Announcement-02.png
" width="30" /></span></td>
<td width="20"> </td>
<td><span style="line-height:1"><span style="font:14px arsenal"><span
style="color:#86c8c5">Refillable Bottle for Life</span></span>
</span>
</td>
</tr>
<tr>
<td height="20"> </td>
</tr>
<tr>
<td width="55"> </td>
<td style="vertical-align: top"><span style="line-height:1"><img height="30"
src="https://i.postimg.cc/52RGgKNg/63724-MYK-PP-Email-Announcement-02.png
" width="30" /></span></td>
<td width="20"> </td>
<td><span style="line-height:1"><span style="font:14px arsenal"><span
style="color:#86c8c5">Soothing Yuzu and<br />
Rice Water Formula</span></span>
</span>
</td>
</tr>
</tbody>
</table>
I'm trying to create an excel spreadsheet with a landing page where I input a specific week number, period number and/or year.
I would then click a button to open an instance of Internet Explorer, navigate to the web form, input the data from the cells in the spreadsheet and then load up the reports selected.
Code for the web form
<br>
<body>
</body>
</html>
<head>
<!--include file="../../Connections/SQL.asp" -->
<title>Performance Reporting</title>
<link href="../../CSS/KPI_Style.css" rel="stylesheet" type="text/css">
<link href="../../CSS/KPI_Style.css" rel="stylesheet" type="text/css">
<link href="../CSS/KPI_Style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style45 {color: #990000}
-->
</style>
<script type="text/javascript" language="javascript">
<!--
function makeDisable(){
var y=document.getElementById("store")
var x=document.getElementById("CHNSplits")
if (y.value=='CP11')
{
x.disabled=true
}
}
function makeEnable(){
var x=document.getElementById("CHNSplits")
x.disabled=false
}
-->
</script>
</head>
<body>
<div align="center">
<link href="../CSS/PL_Style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style2 {font-size: 16px}
.style33 {color: #ffffff}
-->
</style>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#001446" class="border9"><div align="left"><img src="80.gif" alt="DSGi" /></div></td>
<td valign="bottom" bgcolor="#001446" class="border16"><div align="right" class="xbig style1 style33"><span class="style2">Store Performance</span> </div></td>
</tr>
</table>
<br>
<br>
<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
}
body {
background-image: url();
}
.style1 {
color: #d33;
font-size: 18px;
}
.style2 {color: #000000; font-size: 2px; }
.style10 {color: #d33}
.style15 {font-size: 12px}
-->
</style>
<title></title>
</div>
<link href="../../../Testing/KPI/NewKPI/Digital_KPI/stylesheet.css" rel="stylesheet" type="text/css">
<div align="center"><span class="reportname"> Reporting Selection</span></div>
<form name="form1" id="form1" method="post" action="Get_Page_V4.asp">
<input name="store" type="hidden" value="2397" >
<input name="ViewType" type="hidden" value="store" >
<table width="60%" border="1px" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000">
<td colspan="2"><div align="center" class="formnamesmall">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr height="4">
<td></td>
</tr>
<tr height="5">
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td colspan="6"><div align="center" class="formtextverylarge">Selected Location:</span> 1111</div></td>
</tr>
<tr>
<td><input name="RadioGroup1" type="radio" value="1" checked></td>
<td class="formnamesmall" ><strong>Yesterday</td>
<td class="formtext"> </td>
<td class="formtext"> </td>
<td class="formtext"> </td>
<td class="formtext"> </td>
</tr>
<tr height="15">
<td height="10"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
</tr>
<tr class="formtext">
<td><input type="radio" name="RadioGroup1" value="2"></td>
<td class="formnamesmall" ></td>
<td class="formtext"> </td>
<td class="formtext"> </td>
<td class="formnamesmall"> </td>
<td class="formtext">
<input name="datebox" type="hidden" id="datebox" value="07/10/2018" size="10" maxlength="10"></td>
</tr>
<tr height="15">
<td height="10"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
</tr>
<tr>
<td><input type="radio" name="RadioGroup1" value="3"></td>
<td class="formnamesmall" ><strong>Week</td>
<td class="formtext"> </td>
<td class="formtext"> </td>
<td class="formnamesmall">Enter Week </td>
<td class="formtext">
<input name="week" type="text" id="week" value="24" size="2" maxlength="2"></td>
</tr>
<tr>
<td> </td>
<td class="formtext"> </td>
<td class="formtext"> </td>
<td class="formtext"> </td>
<td class="formnamesmall">Enter Financial Year </td>
<td class="formtext">
<input name="weekyear" type="text" id="weekyear" value="2019" size="4" maxlength="4"></td>
</tr>
<tr height="15">
<td height="10"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
</tr>
<tr class="formtext">
<td><label>
<input type="radio" name="RadioGroup1" value="4">
</label></td>
<td class="formnamesmall" ><strong>Period</td>
<td class="formtext"> </td>
<td class="formtext"> </td>
<td class="formnamesmall">Enter Period </td>
<td class="formtext">
<input name="period" type="text" id="period" value="6" size="2" maxlength="2"></td>
</tr>
<tr class="formtext">
<td> </td>
<td class="formtext"> </td>
<td class="formtext"> </td>
<td class="formtext"> </td>
<td class="formnamesmall">Enter Financial Year </td>
<td class="formtext">
<input name="periodyear" type="text" id="periodyear" value="2019" size="4" maxlength="4"></td>
</tr>
<tr height="15">
<td height="10"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
</tr>
<tr height="15">
<td height="10"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
</tr>
<tr class="formtext">
<td><input type="radio" name="RadioGroup1" value="6"></td>
<td class="formnamesmall" ><strong>Year </td>
<td class="formtext"> </td>
<td class="formtext"> </td>
<td class="formnamesmall">Enter Financial Year </td>
<td class="formtext">
<input name="YearYear" type="text" id="YearYear" size="4" maxlength="4" value="2019" ></td>
</tr>
<tr><td height="10"> </td>
<td height="10"> </td>
<td height="10"> </td>
<td height="10"> </td>
<td height="10"> </td>
<td height="10"> </td>
</tr>
<!--
<tr>
<td colspan="4"><div align="center"><span class="formnamesmall style45">Select Report Type</span></div></td>
<td> </td>
<td colspan="2" class="formname" ><strong></td>
</tr>
-->
<td height="10"> </td>
<td height="10"> </td>
<td height="10"> </td>
<td height="10"> </td>
<td height="10"> </td>
<td height="10"> </td>
<tr>
<!--
<td><div align="center">
<input name="RadioGroup2" type="radio" class="Style10" value="1" >
</div></td>
<td>
<div align="right" class="formnamesmall style45">
<div align="left">Charts </div>
</div></td>
-->
<input name="RadioGroup2" type="hidden" class="Style10" value="6" checked="Checked">
<!--
<td><div align="right" class="formnamesmall">
<div align="left" class="style45">League Tables
</div>
</div></td>
-->
<td class="formnamesmall" colspan="4"> </td>
<td><input type="submit" name="Submit" value="Display Report"></td>
</tr>
</table>
<p> </p>
</div></td>
</tr>
</table>
<input name="page_name" type="hidden" value="Region_Page1_" />
</form>
<br>
<br>
<style type="text/css">
<!--
.style1 {
font-size: 10px;
color: #FFFFFF;
}
-->
</style>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign="bottom" bgcolor="#001446"><div align="right" class="xbig style1 style1"> </div></td>
</tr>
</table>
</body>
VBA code
Sub Get_Data()
Dim i As Long
Dim IE As Object
Dim objElement As Object
Dim objCollection As Object
Dim HWNDSrc As Long
Dim dates As Object
Set IE = CreateObject("InternetExplorer.Application")
With IE
.Visible = True
.navigate "http://INTRANETSITE/Summary_Select.asp"
Do Until .readyState = 4 And Not .Busy
DoEvents
Loop
.document.all.Item("radioGroup1")(3).Checked = True 'Select the 4th checkbox down on the list
.document.forms(0).submit 'Submit the form to generate the result
End With
Pause (2)
With IE
.navigate "http://INTRANETSITE/ReportDetail2.asp?"
Do Until .readyState = 4 And Not .Busy
DoEvents
Loop
End With
End Sub
The code above navigates to the web form and does select the 4th radio button which is for period reports, then submits the form and displays the first page.
How do I interact with the text boxes to also amend which week or period I want to select reports for?
Also, when it tries to navigate to ReportDetail2.asp it returns the following error and then crashes the VBA code.
Method 'Navigate' of object 'IWebBrowser2' failed
The long term goal of this is to navigate through 20+ pages of reports, pulling the data from each table into a tab on the spreadsheet, so if it can't navigate between the reports, even before we get to the code to pull the data, then that's a problem.
Try something like the following. I am showing the different options you might consider so remember to comment out those you don't want to use.
You need to add a reference to Microsoft Internet Controls via VBE > Tools > References or use late bound call of
Dim ie As New InternetExplorer : Set ie = CreateObject("InternetExplorer.Application")
VBA:
Option Explicit
Public Sub MakeSelections()
Dim ie As New InternetExplorer
Const URL As String = "yourURL"
With ie
.Visible = True
.navigate URL
While .Busy Or .readyState < 4: DoEvents: Wend
With .document
.querySelector("[value='1']").Checked = True 'Yesterday. CSS attribute = value selector
.querySelector("[value='3']").Checked = True 'Week
.querySelector("[value='4']").Checked = True 'Period
.querySelector("[value='6']").Checked = True 'Year
.getElementById("week").Value = 6 'week value
.getElementById("weekyear").Value = 2018 'financial year value
.getElementById("period").Value = 6 'period value
.getElementById("periodyear").Value = 2018 'period financial year value
.getElementById("yearyear").Value = 2019 'financial year value
.querySelector("[value='Display Report']").Click 'display report
End With
Stop '<== Delete me later
'.Quit '<== Remember to quit application
End With
End Sub
Problem: td with image tag {{im.url}} shows images one below the other, but what I need is to show them side by side horizontally,
Is it possible to expand/merge that td to a size of first row so that I can put 5 images side by side ?
<tbody>
<tr *ngFor="let row of tasks; let i = index" colspan="6">
<td class="text-left" >
<b>
<u>{{row.lowtask}}</u>
</b>
<tr *ngFor="let t of row.time">
<td class="text-left">{{t.time1}}</td>
<td class="text-center">{{t.time2}}</td>
<td class="text-center">{{t.time3}}</td>
<td class="text-right">{{cnvert(t.cur1)}} </td>
<td class="text-right">{{convert(t.cur2)}} </td>
</tr>
<tr *ngFor="let im of row.images">
<td>
<img src="{{im.url}}" class="thumb"/>
</td>
</tr>
</td>
</tr>
</tbody>
You need to adjust your ngFor. Here you go:
<tbody>
<tr *ngFor="let row of tasks; let i = index" colspan="6">
<td class="text-left" >
<b>
<u>{{row.lowtask}}</u>
</b>
<tr *ngFor="let t of row.time">
<td class="text-left">{{t.time1}}</td>
<td class="text-center">{{t.time2}}</td>
<td class="text-center">{{t.time3}}</td>
<td class="text-right">{{cnvert(t.cur1)}} </td>
<td class="text-right">{{convert(t.cur2)}} </td>
</tr>
<tr>
<td *ngFor="let im of row.images">
<img src="{{im.url}}" class="thumb"/>
</td>
</tr>
</td>
</tr>
</tbody>
wrap your td in <ng-container>
<tbody>
<tr *ngFor="let row of tasks; let i = index" colspan="6">
<td class="text-left" >
<b>
<u>{{row.lowtask}}</u>
</b>
<tr *ngFor="let t of row.time">
<td class="text-left">{{t.time1}}</td>
<td class="text-center">{{t.time2}}</td>
<td class="text-center">{{t.time3}}</td>
<td class="text-right">{{cnvert(t.cur1)}} </td>
<td class="text-right">{{convert(t.cur2)}} </td>
</tr>
<tr>
<ng-container *ngFor="let im of row.images">
<td>
<img src="{{im.url}}" class="thumb"/>
</td>
</ng-container>
</tr>
</td>
</tr>
</tbody>
my xml file name is product_file.xml and i have an xslt file , i am using a xml control in my webpage by binding xml & xslt files to the control but i am not getting the output properly. It showing only header multiple times
<?xml version="1.0" encoding="utf-8" ?>
<productlist>
<product>
<itemnumber>1</itemnumber>
<name>Staple Superior Men’s Jacket</name>
<description>The Staple Superior T-bone PU Jacket is classic hood with a drawstring fastening, long and a zip up front fastening.</description>
<color>BLACK</color>
<image>Staplesuperior1.gif</image>
<price>$140</price>
<size>69</size>
<quantity>1</quantity>
<category>Men</category>
</product>
<product>
<itemnumber>2</itemnumber>
<name>Afends Mens t-shirt</name>
<description>The Afends Thrash For Cash Raglan Tee has a scooped hemline, a 100% cotton composition, and a regular fit.</description>
<color>Beach Heather & Black</color>
<image>Afends1.gif</image>
<price>$90</price>
<size>80</size>
<quantity>1</quantity>
<category>Men</category>
</product>
<product>
<itemnumber>3</itemnumber>
<name>Wrangler Men Blue Vegas Skinny Fit Jeans</name>
<description>Blue 5 pocket jeans, stretchable, has a zip fly with buttoned closure in front, 2 scoop pockets at sides</description>
<image>Wrangler1.gif</image>
<color>BLUE</color>
<price>$125</price>
<size>32</size>
<quantity>1</quantity>
<category>Men</category>
</product>
<product>
<itemnumber>4</itemnumber>
<name>Roadster Women Top</name>
<description>Black top, knit, V neck, short extended sleeves, lattice like fabric manipulation detail at shoulders</description>
<color>BLACK</color>
<image>Roadster.gif</image>
<price>$55</price>
<size>Small</size>
<quantity>1</quantity>
<category>Women</category>
</product>
and my xslt file is
<xsl:template match="product">
<html>
<head>
<title>Products XSLT Demo</title>
</head>
<body>
<h2>Products Information</h2>
<br/>
<!--<xsl:copy>
<xsl:apply-templates select="#* | node()"/>
</xsl:copy>-->
<table bgcolor="#008BE7" border="1">
<xsl:for-each select="itemnumber">
<tr>
<td>Item Number</td>
<td>
<xsl:value-of select="itemnumber"/>
</td>
</tr>
<tr> <td>name</td>
<td>
<xsl:value-of select="name"/>
</td>
</tr>
<tr>
<td>description</td>
<td>
<xsl:value-of select="description"/>
</td>
</tr>
<tr>
<td>color</td>
<td>
<xsl:value-of select="color"/>
</td>
</tr>
<tr>
<td>price</td>
<td>
<xsl:value-of select="price"/>
</td>
</tr>
<tr>
<td>size</td>
<td>
<xsl:value-of select="size"/>
</td>
</tr>
<tr> <td>quantity</td>
<td>
<xsl:value-of select="quantity"/>
</td>
</tr>
<tr>
<td>category</td>
<td>
<xsl:value-of select="category"/>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
now the error is the foreach expression not working so the ouput showing only heading multiple times
This seems to be working for me. changing the templatematch to productlist and foreach to product
<xsl:template match="productlist">
<html>
<head>
<title>Products XSLT Demo</title>
</head>
<body>
<h2>Products Information</h2>
<br/>
<!--<xsl:copy>
<xsl:apply-templates select="#* | node()"/>
</xsl:copy>-->
<table bgcolor="#008BE7" border="1">
<xsl:for-each select="product">
<tr>
<td>Item Number</td>
<td>
<xsl:value-of select="itemnumber"/>
</td>
</tr>
<tr> <td>name</td>
<td>
<xsl:value-of select="name"/>
</td>
</tr>
<tr>
<td>description</td>
<td>
<xsl:value-of select="description"/>
</td>
</tr>
<tr>
<td>color</td>
<td>
<xsl:value-of select="color"/>
</td>
</tr>
<tr>
<td>price</td>
<td>
<xsl:value-of select="price"/>
</td>
</tr>
<tr>
<td>size</td>
<td>
<xsl:value-of select="size"/>
</td>
</tr>
<tr> <td>quantity</td>
<td>
<xsl:value-of select="quantity"/>
</td>
</tr>
<tr>
<td>category</td>
<td>
<xsl:value-of select="category"/>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
Change the foreach to
<xsl:for-each select=".">
I am using an asp web application that has a tab. When I click on that tab, an xml file is read. That xml file has data in it. That xml file has a href pointing to an xslt file where I have written code for creating a table for displaying the xml data in the xml file in a presentable manner in the browser.
The user may change the data in the xml file or he may remove some data too, during runtime. I have included a refresh button in the xslt file. During runtime, if the user makes changes to the xml file, I wish to click on the refresh button to reflect the changes in the table in web page. I just want the xml file to be refreshed and the corresponding changes to be reflected in the web page.
How do I do this? I have uploaded my code below :
ASPX FILE
<%# Page Title="Home Page" Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="sampleapp._Default" %>
<%# Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<html>
<head id="Head1" runat="server">
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>
<title>VPGate Configuration</title>
<link rel="stylesheet" type="text/css" href="office2007.css"/>
<link rel="stylesheet" type="text/css" href="style002.css"/>
<script language="javascript" type="text/javascript">
function window.onload() {
try {
if (self != top)
self.parent.location = document.location;
}
catch (Exception) { }
}
</script>
</head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
</telerik:RadScriptManager>
<script type="text/javascript">
function OnClientTabSelected(sender, eventArgs) {
var tab = eventArgs.get_tab();
if (tab.get_tabs().get_count() > 0) {
tab.get_tabs().getTab(0).select();
//tab.get_tabs().getTab(0).click();
}
if (tab.get_text() == "Help") {
document.getElementById("helpframe").style.display = "inline";
document.getElementById("framebody").style.display = "none";
document.getElementById("framebody").src = "";
if (document.getElementById("helpframe").src == "")
document.getElementById("helpframe").src = "/help/ApplicationHelp.htm";
}
else {
document.getElementById("helpframe").style.display = "none";
document.getElementById("framebody").style.display = "inline";
}
}
function OnClientTabSelecting(sender, eventArgs) {
if (!formchk2()) {
eventArgs.set_cancel(true);
return false;
}
}
</script>
<telerik:RadTabStrip ID="tab1" runat="server" ShowBaseLine="True"
EnableEmbeddedSkins="False" ClickSelectedTab="True"
UnSelectChildren="True" SelectedIndex="3"
OnClientTabSelected="OnClientTabSelected" Skin="Office2007" style="margin-left: 29px;border-left-style:none;"
OnClientTabSelecting="OnClientTabSelecting">
<Tabs>
<telerik:RadTab Text="General" NavigateUrl="ShowXML.aspx?file=MMDiagnostics.xml" Target="framebody" Selected="true"></telerik:RadTab>
</Tabs>
</telerik:RadTabStrip>
<iframe id="framebody" name="framebody" runat="server"
style="border-left: thin solid #4173be; border-right: thin solid #4173be; border-bottom: thin solid #4173be; height:112%; width:100%; border-top-width:0px; border-top-color:White;
background-color:white; float:left;height:92.5%; width:97.4%; margin-left:9.5px;"
frameborder="0" scrolling="no">
</iframe>
</form>
</body>
</html>
XML FILE
<?xml-stylesheet type="text/xsl" href="MMDiagnostics.xslt"?>
<MediaMixer>
<Conference>
<Name>Test001</Name>
<ConfId>1000</ConfId>
<CompositeAddress>238.57.0.1</CompositeAddress>
<CompositePort>48000</CompositePort>
<CompositeSsrc>243324353</CompositeSsrc>
<NoOfParticipants>2</NoOfParticipants>
<Participant>
<ID1>80542151</ID1>
<ID2>0</ID2>
<ParticipantAddress>192.168.177.40</ParticipantAddress>
<ParticipantListeningPort>22000</ParticipantListeningPort>
<MMListeningPort>45000</MMListeningPort>
<SSRCFromParticipant>216541</SSRCFromParticipant>
<SSRCFromMM>56481</SSRCFromMM>
</Participant>
<Participant>
<ID1>80542151</ID1>
<ID2>harish</ID2>
<ParticipantAddress>192.168.177.40</ParticipantAddress>
<ParticipantListeningPort>22000</ParticipantListeningPort>
<MMListeningPort>45000</MMListeningPort>
<SSRCFromParticipant>216541</SSRCFromParticipant>
<SSRCFromMM>56481</SSRCFromMM>
</Participant>
<Participant>
<ID1>7825482</ID1>
<ID2>0</ID2>
<ParticipantAddress>192.168.177.22</ParticipantAddress>
<ParticipantListeningPort>22002</ParticipantListeningPort>
<MMListeningPort>45002</MMListeningPort>
<SSRCFromParticipant>3256</SSRCFromParticipant>
<SSRCFromMM>14822456</SSRCFromMM>
</Participant>
</Conference>
<Conference>
<Name>Test002</Name>
<ConfId>1002</ConfId>
<CompositeAddress>238.57.0.1</CompositeAddress>
<CompositePort>48005</CompositePort>
<CompositeSsrc>353324353</CompositeSsrc>
<NoOfParticipants>2</NoOfParticipants>
<Participant>
<ID1>70542151</ID1>
<ID2>0</ID2>
<ParticipantAddress>192.168.177.45</ParticipantAddress>
<ParticipantListeningPort>22004</ParticipantListeningPort>
<MMListeningPort>45004</MMListeningPort>
<SSRCFromParticipant>316541</SSRCFromParticipant>
<SSRCFromMM>26481</SSRCFromMM>
</Participant>
<Participant>
<ID1>70542151</ID1>
<ID2>0</ID2>
<ParticipantAddress>192.168.177.45</ParticipantAddress>
<ParticipantListeningPort>22004</ParticipantListeningPort>
<MMListeningPort>45004</MMListeningPort>
<SSRCFromParticipant>316541</SSRCFromParticipant>
<SSRCFromMM>26481</SSRCFromMM>
</Participant>
<Participant>
<ID1>70542151</ID1>
<ID2>0</ID2>
<ParticipantAddress>192.168.177.45</ParticipantAddress>
<ParticipantListeningPort>22004</ParticipantListeningPort>
<MMListeningPort>45004</MMListeningPort>
<SSRCFromParticipant>316541</SSRCFromParticipant>
<SSRCFromMM>26481</SSRCFromMM>
</Participant>
<Participant>
<ID1>70542151</ID1>
<ID2>0</ID2>
<ParticipantAddress>192.168.177.45</ParticipantAddress>
<ParticipantListeningPort>22004</ParticipantListeningPort>
<MMListeningPort>45004</MMListeningPort>
<SSRCFromParticipant>316541</SSRCFromParticipant>
<SSRCFromMM>26481</SSRCFromMM>
</Participant>
<Participant>
<ID1>70542151</ID1>
<ID2>0</ID2>
<ParticipantAddress>192.168.177.45</ParticipantAddress>
<ParticipantListeningPort>22004</ParticipantListeningPort>
<MMListeningPort>45004</MMListeningPort>
<SSRCFromParticipant>316541</SSRCFromParticipant>
<SSRCFromMM>26481</SSRCFromMM>
</Participant>
<Participant>
<ID1>5625482</ID1>
<ID2>0</ID2>
<ParticipantAddress>192.168.177.20</ParticipantAddress>
<ParticipantListeningPort>22006</ParticipantListeningPort>
<MMListeningPort>45006</MMListeningPort>
<SSRCFromParticipant>8256</SSRCFromParticipant>
<SSRCFromMM>41822456</SSRCFromMM>
</Participant>
</Conference>
</MediaMixer>
XSLT FILE
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>VPGate Media Mixer</title>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache, must-revalidate"/>
<meta http-equiv="refresh" content="15"></meta>
<script src="/Common/common.js\" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="style001.css" />
<link rel="stylesheet" type="text/css" href="Grid.Default.css" />
</head>
<body class="WorkArea">
<div class="divSummaryHeader" id="SummaryHeader">
<h1>Media Mixer - VPGate</h1>
<xsl:for-each select="MMDiagnostics/Conference">
<h1>
Media Mixer - <xsl:value-of select="name"/>
</h1>
</xsl:for-each>
</div>
<div class="RadGrid RadGrid_Default" id="SummaryData" style="position:absolute;width:630px;overflow:auto">
<table border="0" class="rgMasterTable rgClipCells" cellspacing="0" cellpadding="0" >
<tr>
<input type="button" class="formEditBtn" id="SubBtn" value="Refresh" onclick="window.location=window.location;"/>
</tr>
<tr>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;" colspan="2">Conference</td>
</tr>
<tr>
<td>
<table border="0" class="rgMasterTable rgClipCells" cellspacing="0" cellpadding="0" >
<tr>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Name</td>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Conference Id</td>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Composite Address</td>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Composite Port</td>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Composite Ssrc</td>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">No Of Participants</td>
</tr>
<xsl:for-each select="MediaMixer/Conference">
<!--<xsl:sort select="Name"/>-->
<xsl:if test="(position() mod 2 = 0)">
<tr class="rgAltRow SummaryTableDataRow">
<td valign = "top">
<xsl:value-of select="Name"/>
</td>
<td valign = "top">
<xsl:value-of select="ConfId"/>
</td>
<td valign = "top">
<xsl:value-of select="CompositeAddress"/>
</td>
<td valign = "top">
<xsl:value-of select="CompositePort"/>
</td>
<td valign = "top">
<xsl:value-of select="CompositeSsrc"/>
</td>
<td valign = "top">
<xsl:value-of select="NoOfParticipants"/>
</td>
</tr>
</xsl:if>
<xsl:if test="(position() mod 2 = 1)">
<td bgcolor="#aaaaff">
<tr class="rgAltRow SummaryTableDataRow">
<td valign = "top">
<xsl:value-of select="Name"/>
</td>
<td valign = "top">
<xsl:value-of select="ConfId"/>
</td>
<td valign = "top">
<xsl:value-of select="CompositeAddress"/>
</td>
<td valign = "top">
<xsl:value-of select="CompositePort"/>
</td>
<td valign = "top">
<xsl:value-of select="CompositeSsrc"/>
</td>
<td valign = "top">
<xsl:value-of select="NoOfParticipants"/>
</td>
</tr>
</td>
</xsl:if>
</xsl:for-each>
</table>
</td>
</tr>
</table>
<table border="0" class="rgMasterTable rgClipCells" cellspacing="1" cellpadding="1" >
<tr>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;" colspan="2">Participant</td>
</tr>
<tr>
<td>
<table border="0" class="rgMasterTable rgClipCells" cellspacing="0" cellpadding="0" >
<tr>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">ID 1</td>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">ID 2</td>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Participant Address</td>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Participant Listening Port</td>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">MM Listening Port</td>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">SSRC From Participant</td>
<td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">SSRC From MM</td>
</tr>
<xsl:for-each select="MediaMixer/Conference/Participant">
<xsl:if test="(position() mod 2 = 0)">
<tr class="rgAltRow SummaryTableDataRow">
<td valign = "top">
<xsl:value-of select="ID1"/>
</td>
<td valign = "top">
<xsl:value-of select="ID2"/>
</td>
<td valign = "top">
<xsl:value-of select="ParticipantAddress"/>
</td>
<td valign = "top">
<xsl:value-of select="ParticipantListeningPort"/>
</td>
<td valign = "top">
<xsl:value-of select="MMListeningPort"/>
</td>
<td valign = "top">
<xsl:value-of select="SSRCFromParticipant"/>
</td>
<td valign = "top">
<xsl:value-of select="SSRCFromMM"/>
</td>
</tr>
</xsl:if>
<xsl:if test="(position() mod 2 = 1)">
<td bgcolor="#aaaaff">
<tr class="rgAltRow SummaryTableDataRow">
<td valign = "top">
<xsl:value-of select="ID1"/>
</td>
<td valign = "top">
<xsl:value-of select="ID2"/>
</td>
<td valign = "top">
<xsl:value-of select="ParticipantAddress"/>
</td>
<td valign = "top">
<xsl:value-of select="ParticipantListeningPort"/>
</td>
<td valign = "top">
<xsl:value-of select="MMListeningPort"/>
</td>
<td valign = "top">
<xsl:value-of select="SSRCFromParticipant"/>
</td>
<td valign = "top">
<xsl:value-of select="SSRCFromMM"/>
</td>
</tr>
</td>
</xsl:if>
</xsl:for-each>
</table>
</td>
</tr>
</table>
<div style="display:none">
<iframe id="frameUpdate" name="frameUpdate" width="100%"></iframe>
</div>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
You can set at the client side timer using setTimeout function.
Eeach time you can read the xml and check modified date
of the file. Or for example to set attribute in XML changedDate and to check it
each time.If it's changed from previous one you can refresh the xml .
So as I stated previously you can check modified data of xml or to set attribute "ModifiedDate" in XML .
When someone updates XML , he must change update the attribure.