Hi, been a real long time since I have worked in ASP and XML and a neighbor asked me to help him with a web page. I have an XML file that I am trying to search thru and display the children nodes......
Here is a sample of the xml
<document>
<MEMBER>
<ID>000-00-0010</ID>
<CHARGES>
<CHARGE><ChargeDate>06/25/2007</ChargeDate><Code>BANQ</Code><Desc>BANQUET</Desc><Amount>0.00</Amount><Note></Note></CHARGE>
<CHARGE><ChargeDate>06/25/2007</ChargeDate><Code>OSR</Code><Desc>RENT</Desc><Amount>0.00</Amount><Note></Note></CHARGE>
<CHARGE><ChargeDate>06/25/2007</ChargeDate><Code>PR</Code><Desc>POSTAGE REIMBUR</Desc><Amount>0.00</Amount><Note></Note></CHARGE>
<CHARGE><ChargeDate>06/25/2007</ChargeDate><Code>YBS</Code><Desc>YRBK SPONSOR</Desc><Amount>0.00</Amount><Note></Note></CHARGE>
<CHARGE><ChargeDate>06/25/2007</ChargeDate><Code>ZA</Code><Desc>ADMIN.FEE</Desc><Amount>0.00</Amount><Note></Note></CHARGE>
</CHARGES>
<PAYMENT>
<PaymentDate></PaymentDate><PaymentAmount>0.00</PaymentAmount>
</PAYMENT>
</MEMBER>
<MEMBER>
<ID>000-00-0011</ID>
<CHARGES>
<CHARGE><ChargeDate>06/25/2007</ChargeDate><Code>PC</Code><Desc>SICK COMPER CAP</Desc><Amount>558.00</Amount><Note>10/31/2004</Note></CHARGE>
<CHARGE><ChargeDate>06/25/2007</ChargeDate><Code>ZA</Code><Desc>ADMIN.FEE</Desc><Amount>16.74</Amount><Note></Note></CHARGE>
</CHARGES>
<PAYMENT>
<PaymentDate></PaymentDate><PaymentAmount>0.00</PaymentAmount>
</PAYMENT>
</MEMBER>
<MEMBER>
<ID>000-00-0012</ID>
<CHARGES>
<CHARGE><ChargeDate>06/25/2007</ChargeDate><Code>ZA</Code><Desc>ADMIN.FEE</Desc><Amount>0.00</Amount><Note></Note></CHARGE>
</CHARGES>
<PAYMENT>
<PaymentDate></PaymentDate><PaymentAmount>0.00</PaymentAmount>
</PAYMENT>
</MEMBER>
</document>
I have put together this XLS file
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="<xsl:template match="/">
<h1>Charges</h1>
<table cellpadding="3" cellspacing="0">
<tr>
<th>Charge Date</th>
<th>Charge Code</th>
<th>Description</th>
<th>Amount</th>
<th>Note</th>
</tr>
<xsl:apply-templates select="//CHARGE"/>
</table>
</xsl:template>
<xsl:template match="CHARGE">
<tr>
<td><xsl:value-of select="ChargeDate" /></td>
<td><xsl:value-of select="Code" /></td>
<td><xsl:value-of select="Desc" /></td>
<td><xsl:value-of select="Amount" /></td>
<td><xsl:value-of select="Note" /></td>
</tr>
</xsl:template>
</xsl:stylesheet>
What I am trying to do is display the charges for say ID = 000-00-0010
Here is the VB script I am trying to use.....
function transformDetailXML( XML, XSL, strDetail )
Dim objXML
Dim objXSL
Dim objNode
'dim objCharges
Set objXML = getXMLDoc(XML)
Set objNode = objXML.SelectSingleNode("document/MEMBER/ID/[text()='" & strDetail & "']")
'Set objCharges = objNode.selectNodes("/CHARGES[CHARGE]")
Set objXSL = getXMLDoc(XSL)
If objXML.parseError <> 0 Then Response.Write reportParseError(objXML.parseError)
If objXSL.parseError <> 0 Then Response.Write reportParseError(objXSL.parseError)
transformDetailXML = objNode.transformNode(objXSL)
End Function
And lastly, this is what is showing in my browser....
Searching Mode
<ID>000-00-0010</ID>
Thanks in advance for your help.....
Here is a sample of the xml
<document>
<MEMBER>
<ID>000-00-0010</ID>
<CHARGES>
<CHARGE><ChargeDate>06/25/2007</ChargeDate><Code>BANQ</Code><Desc>BANQUET</Desc><Amount>0.00</Amount><Note></Note></CHARGE>
<CHARGE><ChargeDate>06/25/2007</ChargeDate><Code>OSR</Code><Desc>RENT</Desc><Amount>0.00</Amount><Note></Note></CHARGE>
<CHARGE><ChargeDate>06/25/2007</ChargeDate><Code>PR</Code><Desc>POSTAGE REIMBUR</Desc><Amount>0.00</Amount><Note></Note></CHARGE>
<CHARGE><ChargeDate>06/25/2007</ChargeDate><Code>YBS</Code><Desc>YRBK SPONSOR</Desc><Amount>0.00</Amount><Note></Note></CHARGE>
<CHARGE><ChargeDate>06/25/2007</ChargeDate><Code>ZA</Code><Desc>ADMIN.FEE</Desc><Amount>0.00</Amount><Note></Note></CHARGE>
</CHARGES>
<PAYMENT>
<PaymentDate></PaymentDate><PaymentAmount>0.00</PaymentAmount>
</PAYMENT>
</MEMBER>
<MEMBER>
<ID>000-00-0011</ID>
<CHARGES>
<CHARGE><ChargeDate>06/25/2007</ChargeDate><Code>PC</Code><Desc>SICK COMPER CAP</Desc><Amount>558.00</Amount><Note>10/31/2004</Note></CHARGE>
<CHARGE><ChargeDate>06/25/2007</ChargeDate><Code>ZA</Code><Desc>ADMIN.FEE</Desc><Amount>16.74</Amount><Note></Note></CHARGE>
</CHARGES>
<PAYMENT>
<PaymentDate></PaymentDate><PaymentAmount>0.00</PaymentAmount>
</PAYMENT>
</MEMBER>
<MEMBER>
<ID>000-00-0012</ID>
<CHARGES>
<CHARGE><ChargeDate>06/25/2007</ChargeDate><Code>ZA</Code><Desc>ADMIN.FEE</Desc><Amount>0.00</Amount><Note></Note></CHARGE>
</CHARGES>
<PAYMENT>
<PaymentDate></PaymentDate><PaymentAmount>0.00</PaymentAmount>
</PAYMENT>
</MEMBER>
</document>
I have put together this XLS file
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="<xsl:template match="/">
<h1>Charges</h1>
<table cellpadding="3" cellspacing="0">
<tr>
<th>Charge Date</th>
<th>Charge Code</th>
<th>Description</th>
<th>Amount</th>
<th>Note</th>
</tr>
<xsl:apply-templates select="//CHARGE"/>
</table>
</xsl:template>
<xsl:template match="CHARGE">
<tr>
<td><xsl:value-of select="ChargeDate" /></td>
<td><xsl:value-of select="Code" /></td>
<td><xsl:value-of select="Desc" /></td>
<td><xsl:value-of select="Amount" /></td>
<td><xsl:value-of select="Note" /></td>
</tr>
</xsl:template>
</xsl:stylesheet>
What I am trying to do is display the charges for say ID = 000-00-0010
Here is the VB script I am trying to use.....
function transformDetailXML( XML, XSL, strDetail )
Dim objXML
Dim objXSL
Dim objNode
'dim objCharges
Set objXML = getXMLDoc(XML)
Set objNode = objXML.SelectSingleNode("document/MEMBER/ID/[text()='" & strDetail & "']")
'Set objCharges = objNode.selectNodes("/CHARGES[CHARGE]")
Set objXSL = getXMLDoc(XSL)
If objXML.parseError <> 0 Then Response.Write reportParseError(objXML.parseError)
If objXSL.parseError <> 0 Then Response.Write reportParseError(objXSL.parseError)
transformDetailXML = objNode.transformNode(objXSL)
End Function
And lastly, this is what is showing in my browser....
Searching Mode
<ID>000-00-0010</ID>
Thanks in advance for your help.....