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. Tree Navigation

Tree Navigation

Scheduled Pinned Locked Moved XML / XSL
xmlhtmlwpfdata-structuresregex
2 Posts 2 Posters 2 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.
  • A Offline
    A Offline
    act_x
    wrote on last edited by
    #1

    My XML Document is the following My XSLT CODe is as `<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <html> <body> <h2>AOM MODEL</h2> <br>top</br> <xsl:apply-templates select="OBJECT"/> <xsl:for-each select="OBJECT"> <xsl:apply-templates select="OBJECT"/> <xsl:for-each select="OBJECT"> <xsl:apply-templates select="OBJECT"/> <xsl:for-each select="OBJECT"/> </xsl:for-each> </xsl:for-each> </body> </html> </xsl:template> <xsl:template match="OBJECT"> <span style="color:#0000FF"> <br> <xsl:value-of select="@Class"/> </br> </span> </xsl:template> <xsl:template match="PROPERTY"> <br> <span style="color:#ff0000"> <xsl:value-of select="."/> </span> </br> </xsl:template> </xsl:stylesheet>` The output is AOM MODEL top CRange CKeyboard COven CSettings CDigitalInput CDigitalOutput This does not reflect the heirarchy and is wrong . What should i be doing to get AOM MODEL top CRange CKeyboard COven CDigitalInput CDigitalOutput CSettings what am i doing wrong ? I basically need a tree traversal ? Please help

    M 1 Reply Last reply
    0
    • A act_x

      My XML Document is the following My XSLT CODe is as `<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <html> <body> <h2>AOM MODEL</h2> <br>top</br> <xsl:apply-templates select="OBJECT"/> <xsl:for-each select="OBJECT"> <xsl:apply-templates select="OBJECT"/> <xsl:for-each select="OBJECT"> <xsl:apply-templates select="OBJECT"/> <xsl:for-each select="OBJECT"/> </xsl:for-each> </xsl:for-each> </body> </html> </xsl:template> <xsl:template match="OBJECT"> <span style="color:#0000FF"> <br> <xsl:value-of select="@Class"/> </br> </span> </xsl:template> <xsl:template match="PROPERTY"> <br> <span style="color:#ff0000"> <xsl:value-of select="."/> </span> </br> </xsl:template> </xsl:stylesheet>` The output is AOM MODEL top CRange CKeyboard COven CSettings CDigitalInput CDigitalOutput This does not reflect the heirarchy and is wrong . What should i be doing to get AOM MODEL top CRange CKeyboard COven CDigitalInput CDigitalOutput CSettings what am i doing wrong ? I basically need a tree traversal ? Please help

      M Offline
      M Offline
      Michael A Barnhart
      wrote on last edited by
      #2

      Is this what you want? What processor are you using? I had to change the xmlns to something newer to run this through MSXML 4. I also had to correct the case of the match and select values to your xml file. **************** XML FILE ***************** *************** XSL FILE ********************

      AOM MODEL

      top

      ************** out put ****************** AOM MODEL top CRange CKeyboard COven CDigitalInput CDigitalOutput CSettings ""

      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