Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Generic XSLT

Generic XSLT

Scheduled Pinned Locked Moved XML / XSL
xmlhtmlwpfregexquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gktony
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups