Subject: RE: [xsl] Urgent : Nested List Help From: Pieter Reint Siegers Kort <pieter.siegers@xxxxxxxxxxx> Date: Thu, 3 Feb 2005 17:08:35 -0600 |
Hi Sefa, Just delete <xsl:template match="link/link"> <li> <xsl:value-of select="@name"/> </li> <ul> <xsl:apply-templates /> </ul> </xsl:template> from your stylesheet. HTH, <prs/> -----Original Message----- From: Sefa Sevtekin [mailto:sevtekin@xxxxxxxxxxx] Sent: Thursday, February 03, 2005 3:58 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] Urgent : Nested List Help Hi, I am trying to transform an XML file by using XSL and display it as html. Here is the XML: <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="links.xsl"?> <links> <link name="1"> <link name="1.1" url="#"/> <link name="1.2"> <link name="1.2.1"/> <link name="1.2.2"/> </link> </link> <link name="2"> <link name="2.1"> <link name="2.1.1"/> <link name="2.1.2"/> <link name="2.1.3"/> </link> <link name="2.2"> <link name="2.2.1"/> <link name="2.2.2"/> <link name="2.2.3"/> </link> <link name="2.3"/> </link> <link name="3"/> </links> and here is the XSL: <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <head> </head> <body> <ul> <xsl:apply-templates select="links/link"/> </ul> </body> </html> </xsl:template> <xsl:template match="link"> <li> <xsl:value-of select="@name"/> </li> <xsl:apply-templates /> </xsl:template> <xsl:template match="link/link"> <li> <xsl:value-of select="@name"/> </li> <ul> <xsl:apply-templates /> </ul> </xsl:template> </xsl:stylesheet> and here is the output html: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <html> <head> </head> <body> <ul> <li>1</li> <li>1.1</li> <ul> </ul> <li>1.2</li> <ul> <li>1.2.1</li> <ul> </ul> <li>1.2.2</li> <ul> </ul> </ul> <li>2</li> <li>2.1</li> <ul> <li>2.1.1</li> <ul> </ul> <li>2.1.2</li> <ul> </ul> <li>2.1.3</li> <ul> </ul> </ul> <li>2.2</li> <ul> <li>2.2.1</li> <ul> </ul> <li>2.2.2</li> <ul> </ul> <li>2.2.3</li> <ul> </ul> </ul> <li>2.3</li> <ul> </ul> <li>3</li> </ul> </body> </html> The problem is xsl creates empty <ul></ul> in between. Can you help me fix it? Thanks
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Urgent : Nested List Help, David Carlisle | Thread | RE: [xsl] Urgent : Nested List Help, Sefa Sevtekin |
RE: [xsl] New to XSLT: problem wit, Michael Kay | Date | RE: [xsl] with-param problem, Pieter Reint Siegers |
Month |