|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] How to extract values from nodes.
Hi all,
I have an XML file from which I have to read the elements and
display it in a table as a row.This row should have a checkbox at the
beginning and a button at the end.Multiple selection is allowed and the
values of some of the columns of the selected rows have to be passed to
the server for processing.
My XML is of this form.
<InvoiceInformation>
<Invoice>
<VendorCode>V001</VendorCode>
<InformationIdentifierCode>I001</InformationIdentifierCode>
<DataCreateDate>1999-07-07</DataCreateDate>
<CommonDataCreationTime>12-07-1999</CommonDataCreationTime>
<BuyerCode>5523918</BuyerCode>
<IssueLocationId>shovel</IssueLocationId>
<OrderIssueLocationId>399</OrderIssueLocationId>
<ProductNameCodeForBuyer>19981023</ProductNameCodeForBuyer>
<PurchaseOrderNo>19981103</PurchaseOrderNo>
<DeliveryKeyNo>19981103</DeliveryKeyNo>
<VolumeOfInvoice>1998</VolumeOfInvoice>
<Unit>Kg</Unit>
<NoOfPartialDelivery>19</NoOfPartialDelivery>
<DeliveredDate>1998-11-03</DeliveredDate>
<UnitPrice>9811</UnitPrice>
<PurchaseOrderAmount>9981103</PurchaseOrderAmount>
<AmountOfConsumptionTax>998</AmountOfConsumptionTax>
<TotalAmount>19981103</TotalAmount>
<ReturnId>03</ReturnId>
<ReIssueId>11</ReIssueId>
<VendorName>Wipro</VendorName>
</Invoice>
</InvoiceInformation>
I have to use LotusXSL processor to convert my XML into HTML using
XSL..I have attached the code I had used.But the Javascript executes
with all the records and I always end up with the values of the last
record.Is there a better way than by using Javascript and How do I do it
?
Thanks,
ManiKandan
Senior Software Engineer,
Wipro Enterprise Solutions,
Bangalore.
India.
<?xml version="1.0"?>
<!-- A test for xsl:counter -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"
xmlns="http://www.w3.org/TR/REC-html40" result-ns="">
<xsl:template match="InvoiceInformation">
<HTML>
<HEAD>
<SCRIPT>
</SCRIPT>
</HEAD>
<BODY>
<FORM>
<TABLE BORDER="1">
<TH></TH>
<TH>VendorCode</TH>
<TH>IdCode</TH>
<TH>DataDate</TH>
<TH>LocationId</TH>
<TH>OrderIssueLocationId</TH>
<TH>ProductCode</TH>
<TH>DeliveryKeyNo</TH>
<xsl:apply-templates select="Invoice"/>
</TABLE>
<INPUT TYPE = "BUTTON" NAME="mainbutt" VALUE="Generate Invoice"></INPUT>
</FORM>
</BODY>
</HTML>
</xsl:template>
<xsl:template match="Invoice">
<TR>
<SCRIPT language="JavaScript">
var val = "";
var count=0;
function showMessage(checkVal){
count = count +1;
val = "<xsl:value-of select='./VendorCode'/>|<xsl:value-of select='./InformationIdentifierCode'/>";
alert(val);
checkVal.value = val;
return checkVal.value;
}
</SCRIPT>
<TD><INPUT TYPE = "CHECKBOX" NAME="checkname" VALUE="" ONCLICK="this.value=showMessage(this)"></INPUT></TD>
<TD><xsl:apply-templates select="VendorCode"/></TD>
<TD><xsl:apply-templates select="InformationIdentifierCode"/></TD>
<TD><xsl:apply-templates select="CommonDataCreationTime"/></TD>
<TD><xsl:apply-templates select="IssueLocationId"/></TD>
<TD><xsl:apply-templates select="OrderIssueLocationId"/></TD>
<TD><xsl:apply-templates select="ProductNameCodeForBuyer"/></TD>
<TD><xsl:apply-templates select="DeliveryKeyNo"/></TD>
<TD><INPUT TYPE = "BUTTON" NAME="butt" VALUE="Detail" ONCLICK="alert('Hai')"></INPUT></TD>
</TR>
</xsl:template>
</xsl:stylesheet>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








