RE: [xsl] So many unwanted elements in output how to remove?

Subject: RE: [xsl] So many unwanted elements in output how to remove?
From: "abradoom" <thiabek@xxxxxxxxxxx>
Date: Thu, 8 Aug 2002 06:41:59 UT
> 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

Thanks a lot
As far as DOCTYPE is concerned that i am sending through a different
file .like

header("Content-type:text/vnd.wap.wml");
echo("<?xml version=\"1.0\"?>");
echo("<!DOCTYPE wml PUBLIC '-//WAPFORUM//DTD WML 1.2//EN'
'http://www.wapforum.org/DTD/wml_1.2.xml'> ");

So it is coming in output.This i am doing through php as my xslt
processor is sablotron (It is supported by php).
And yes i manually change the text of input file just written the
problem in place of the text.
But as far as output is concerned (wml output and ouput)that may be
during copying  some how deleted as after getting output i copied them
so out put is from the correct file.
and the problem is still the same .
So many <p> and </p> why they are coming.
And if i want to test for <br /> that if it is just after a <a> or <li>
or <br /> then do not put <br /> in output.

how to do that.
here are input and out put.
input html.
<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>

xsl 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="output">
<xsl:apply-templates/>
</card>
</wml>
</xsl:template>
<xsl:template match="head"/>
<xsl:template match="body">
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="p/div | div/div | center/div | font/div">
<xsl:apply-templates/>
</xsl:template>
   
<xsl:template match="div">
<p><xsl:apply-templates/></p>
</xsl:template>

<xsl:template match="font/p | center/p | div/p | p/p">
<xsl:apply-templates/>
</xsl:template>     
      
<xsl:template match="p">
<p><xsl:apply-templates/></p>
</xsl:template>

<xsl:template match="p/font | center/font | div/font | font/font">
<xsl:apply-templates/>
</xsl:template>     

<xsl:template match="font">
<p><xsl:apply-templates/></p>
</xsl:template>

<xsl:template match="font/br | div/br | center/br | p/br ">
<br/>
</xsl:template>

<xsl:template match="body/text()">
<p><xsl:apply-templates/></p>
</xsl:template>

</xsl:stylesheet>

and the output 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="wml
  output">

<p>
</p><p>This is for br tag</p><p>

</p><p>The stylesheet is doing some mischief</p><p>

</p><p>WHAT IS THE REASON ?</p><p>

</p><p>
</p><p>
</p><p>
</p><p>
</p><p>
</p><p>
</p><p>Is it not the proper syntax for matching<br/>
 tag.</p><p>

</p><p>
</p><p>
</p>
</card></wml>

thiabek
-- 
http://fastmail.fm/ - The professional email service

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread