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