Click here to Skip to main content
15,896,201 members
Home / Discussions / XML / XSL
   

XML / XSL

 
GeneralRe: What's usually used to parse an XML file Pin
Scott Dorman5-Jan-08 6:36
professionalScott Dorman5-Jan-08 6:36 
GeneralRe: What's usually used to parse an XML file Pin
DavidNohejl14-Jan-08 3:13
DavidNohejl14-Jan-08 3:13 
GeneralXML starting... Pin
kingletas20-Dec-07 3:28
kingletas20-Dec-07 3:28 
GeneralRe: XML starting... Pin
pmarfleet20-Dec-07 9:32
pmarfleet20-Dec-07 9:32 
GeneralGeneric XSLT Pin
Gktony16-Dec-07 0:21
Gktony16-Dec-07 0:21 
GeneralRe: Generic XSLT Pin
Prateek G16-Dec-07 19:12
Prateek G16-Dec-07 19:12 
GeneralRe: Generic XSLT Pin
Gktony16-Dec-07 23:59
Gktony16-Dec-07 23:59 
GeneralGeneric XSLT Pin
Gktony16-Dec-07 0:18
Gktony16-Dec-07 0:18 
Hi all,

I need to create a generic XSLT to extract the third level elements of an XML file without having to specify the element names in the XPath.
The XML file looks like that
<?xml version="1.0" encoding="ISO-8859-1"?>
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
.
.
.
</catalog>

I need to put the Elements names like title, artist, etc. in a table as header and the element text Empire Burlesque, Bob Dylan in a .
Can someone assist me with this please it seems I cannot get it right myself. Here's what I am trying but doesn't work
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<html>
<body>
<!-- The heading -->
<div>
Results
</div>

<br/>

<!-- Define the table itself -->
<table width="100%" border="1">
<xsl:apply-templates/>
</table>
</body>
</html>
</xsl:template>

<xsl:template match="*">
<xsl:for-each select="*">
<xsl:sort select="*"/>
<tr>
<td><xsl:value-of select="*"/></td>
</tr>
</xsl:for-each>

</xsl:template>

</xsl:stylesheet>

Thanks

Tony
GeneralVTD-XML tutorials now available Pin
Jimmy Zhang15-Dec-07 16:44
Jimmy Zhang15-Dec-07 16:44 
NewsVTD-XML tutorials now available Pin
Jimmy Zhang15-Dec-07 16:42
Jimmy Zhang15-Dec-07 16:42 
Generaldouble array into an XML file Pin
ceken15-Dec-07 7:06
ceken15-Dec-07 7:06 
GeneralRe: double array into an XML file Pin
pmarfleet15-Dec-07 9:29
pmarfleet15-Dec-07 9:29 
GeneralRe: double array into an XML file Pin
ceken15-Dec-07 20:41
ceken15-Dec-07 20:41 
GeneralRe: double array into an XML file Pin
ceken15-Dec-07 20:48
ceken15-Dec-07 20:48 
Generalnewbie question: xsd -&gt; unpopulated xml Pin
spin vector14-Dec-07 5:32
spin vector14-Dec-07 5:32 
GeneralRegarding multi coulmned output from xsl.... Pin
Ron.S10-Dec-07 20:03
Ron.S10-Dec-07 20:03 
GeneralRe: Regarding multi coulmned output from xsl.... Pin
led mike12-Dec-07 7:35
led mike12-Dec-07 7:35 
Questionhow can make the client of Gnetella(2) client. Pin
tika/ajay10-Dec-07 8:50
tika/ajay10-Dec-07 8:50 
GeneralViewing query results with XSLT Pin
Vodstok10-Dec-07 4:39
Vodstok10-Dec-07 4:39 
GeneralRe: Viewing query results with XSLT Pin
pmarfleet10-Dec-07 10:43
pmarfleet10-Dec-07 10:43 
GeneralPassing parameters to XSLT Pin
Gktony9-Dec-07 6:46
Gktony9-Dec-07 6:46 
GeneralRe: Passing parameters to XSLT Pin
Prateek G9-Dec-07 19:35
Prateek G9-Dec-07 19:35 
GeneralRe: Passing parameters to XSLT Pin
Gktony10-Dec-07 1:59
Gktony10-Dec-07 1:59 
GeneralRe: Passing parameters to XSLT Pin
Prateek G10-Dec-07 2:16
Prateek G10-Dec-07 2:16 
GeneralPassing xsl:param Pin
Gktony9-Dec-07 6:43
Gktony9-Dec-07 6:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.