Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extract data from xml file 1

Status
Not open for further replies.

vitorpt

Technical User
Apr 29, 2010
1
PT
Hi to all

I'm new to the forum and to this file format. I've searched but didn't find anything related to my question.

This is the file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<factura-detalhe ano="2010" mes="01">
<registo nif="500000000" nr-conta="12345678" nr-factura="416686168" telemovel="911111111" data="01-12-2009" hora="10:11:43" periodo-facturado="450" dados-kb-facturado="0" nr-chamado="96111111" tipo-chamada="2468" valor="0.000" servico="Vp F"/>
<registo nif="500000000" nr-conta="12345678" nr-factura="416686168" telemovel="910000000" data="01-12-2009" hora="20:30:38" periodo-facturado="0" dados-kb-facturado="0" nr-chamado="96111222" tipo-chamada="3070" valor="0.000" servico="Vp O"/>
</factura-detalhe>

I was playing with w3schools code to extract data but none showed up:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<xsl:stylesheet version="1.0" xmlns:xsl="
<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>conta</th>
<th>factura</th>
</tr>
<xsl:for-each select="registo/nif">
<tr>
<td><xsl:value-of select="nr-conta"/></td>
<td><xsl:value-of select="nr-factura"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

What I need is to extract data from the xml file and write it to an access file with ASP.
Any help?

Thanks
Vitor
 
[tt]<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<xsl:stylesheet version="1.0" xmlns:xsl="[ignore][/ignore]">
[blue]<xsl:eek:utput method="html" />[/blue]
<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>conta</th>
<th>factura</th>
</tr>
<xsl:for-each select="[red]factura-detalhe/registo[/red]">
<tr>
<td><xsl:value-of select="[red]@[/red]nr-conta"/></td>
<td><xsl:value-of select="[red]@[/red]nr-factura"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top