Subject: RE: [xsl] So many unwanted elements in output how to remove? From: "Kirk Allen Evans" <kaevans@xxxxxxxxxxxxx> Date: Wed, 7 Aug 2002 12:35:26 -0400 |
> -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of abradoom > Sent: Wednesday, August 07, 2002 12:08 PM > To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] So many unwanted elements in output how to remove? > > > Hello list > I am new to list and hope i can explain the problem. > I have a html file. Using your example, template (10) is never reached. Removing this template rule has no effect on the output. More problematic is that this XSLT is not the stylesheet used to generate the literal output you listed, or you have copied something incorrectly: the card's title attribute, according to the stylesheet, is "wml output", but your result shows it as simply "output". Similarly, you have a DOCTYPE that is not represented in either the input or stylesheet, yet appears in the output. Try posting the real XSLT used and the real input XML used. You could probably benefit from a tool to help in debugging stylesheets. Try Marrowsoft's Xselerator [1]. [1] http://www.topxml.com/xselerator Kirk Allen Evans http://www.xmlandasp.net "XML and ASP.NET", New Riders Publishing http://www.amazon.com/exec/obidos/ASIN/073571200X > <html> > <head> > <meta name="generator" content="HTML Tidy, see www.w3.org" /> > <title>HELLO LIST</title> > </head> > <body bgcolor="#C4C4C4" text="#443481" link="#1111EE"> > <p>This is for br tag</p> > > <div>The stylesheet is doing some mischief</div> > > <div><font size="+1">WHAT IS THE REASON ?</font></div> > > <br /> > <br /> > <br /> > <br /> > <br /> > <br /> > <p>Is it not the proper syntax for matching<br /> > tag.</p> > > <br /> > <br /> > </body> > </html> > > and an xsl i have written is > > <?xml version="1.0"?> > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > > <xsl:output omit-xml-declaration="yes"/> > > <xsl:template match="/"> > <wml> > <card title="wml output"> > <xsl:apply-templates/> > </card> > </wml> > </xsl:template> > > > > (1)<xsl:template match="head"/> > > > (2)<xsl:template match="body"> > <xsl:apply-templates/> > </xsl:template> > > (3)<xsl:template match="p/div | div/div | center/div | font/div"> > <xsl:apply-templates/> > </xsl:template> > > (4)<xsl:template match="div"> > <p><xsl:apply-templates/></p> > </xsl:template> > > > (5)<xsl:template match="font/p | center/p | div/p | p/p/"> > <xsl:apply-templates/> > </xsl:template> > > > (6)<xsl:template match="p"> > <p><xsl:apply-templates/></p> > </xsl:template> > > > (7)<xsl:template match="p/font | center/font | div/font | font/font"> > <xsl:apply-templates/> > </xsl:template> > > (8)<xsl:template match="font"> > <p><xsl:apply-templates/></p> > </xsl:template> > > (9)<xsl:template match="font/br | div/br | center/br | p/br "> > <br/> > </xsl:template> > > (10)<xsl:template match="body/text()"> > <p><xsl:apply-templates/></p> > </xsl:template> > > > </xsl:stylesheet> > > numbers are only for ease to explain. > > the output i am getting is . > <?xml version="1.0"?><!DOCTYPE wml PUBLIC '-//WAPFORUM//DTD WML > 1.2//EN' > 'http://www.wapforum.org/DTD/wml_1.2.xml'><wml><card title="output"> > > <p/><p>This is for br tag</p><p/><p>The stylesheet is doing some > mischief</p><p/><p>WHAT IS THE REASON > ?</p><p/><p/><p/><p/><p/><p/><p/><p>Is it not the proper syntax for > matching<br/> > tag.</p><p/><p/><p/> > </card></wml> > > The problem is it has so many unwanted <p> and </p> .they are because > of (10) perhaps. > But if i remove (10) i am not getting text in output which is not in > side of any tag but body. > how to do that? > and i used this > <xsl:template match="br[not(preceding-sibling::node()[1][self::br])] | > br[not(preceding-sibling::node()[1][self::a])] | > br[not(preceding-sibling::node()[1][self::li])]"> > <br/> > </xsl:template> > for <br> because i do not want to put <br /> in output if they are just > after <a> or <li> or <br> likr <br/><br/><br/> <br/> <br/> .so in place > of that many <br/> put only one <br/> for first one then ignore.but it > is not working syntactically incorrect? or logically? > > abradoom > -- > http://fastmail.fm/ - Consolidate POP email and Hotmail in one place > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
<- Previous | Index | Next -> |
---|---|---|
[xsl] So many unwanted elements in , abradoom | Thread | RE: [xsl] So many unwanted elements, abradoom |
[xsl] finding attributes values, Carlos Durand | Date | [xsl] xsl-list@lists.mulberrytech.c, Amanda Birmingham |
Month |