[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Why processor or stylesheets puts strange output

Subject: Why processor or stylesheets puts strange output
From: "abradoom" <thiabek@xxxxxxxxxxx>
Date: Fri, 23 Aug 2002 10:05:51 UT
p bgcolor
hello 
I have been wondering why a simple thing is bothering me so much.
i asked this on list...... got reply......  tried that...... and after
all the things
IT IS NOT WORKING

and this mail is quite lengthy as i wanted to explain every thing which
i can.
I have a simple 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><br />
<br />
<br />
</div>

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

<br />
<br />
<br />
<br />
<br />
it is text which has body as parent
</body>
</html>

i wrote a simple stylesheet to convert it in WML

<?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="br[preceding-sibling::node()[1][self::br]]" />
	


<xsl:template match="body/text()" />

<xsl:template match="body/br" />

<xsl:template match="br">
 <br />
 </xsl:template>

</xsl:stylesheet>

You must be wondering why so many <br />template match.but that is the
whole problem.
all i want to do is put <br /> in the output if it is in input.that is
simple.
but i want if the <br />is just after <a> ...</a> or <li>...</li> or
<br /> or it has body it's parent then do not put <br /> in the output.
now when i wrote this in the style sheet
<xsl:template match="body/text()">
<p><xsl:apply-templates /></p>
</xsl:template>

and removing <xsl:template match="body/text()" />
i got this output 
<?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 ?<br/>
<br/>
<br/>
</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>

the strange thing is the so many <p /> tags .i do not know from where
they are coming as there is no <p /> in the stylesheet though many <p>
and </p> are there.
and not giving the "it is text which has body as parent" .I thought to
sacrifice that ok not coming this text which has body as parent.
but i tried for  not putting<br />in output if it is after <br /> as
written in the style sheet(though i want to test for <a> <li> and <br
/> but i tried only for <br /> )
but it is giving this output
<?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>This is for br tag</p><p>The stylesheet is doing some
mischief</p><p>WHAT IS THE REASON ?<br/>
<br/>
<br/>
</p><p>Is it not the proper syntax for matching<br/>
tag.</p>
</card></wml>

this is better than that though not outputing text having body as
parent but it has no strange <p/>.
but it still has three <br /> after "WHAT IS THE REASON?" but it should
have one <br />.
for this output i have used the stylesheet which is given .
can any one tell me about strange out out and how to get correct
output.

output should be like something

<?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>This is for br tag</p><p>The stylesheet is doing some
mischief</p><p>WHAT IS THE REASON ?<br/>
</p><p>Is it not the proper syntax for matching<br/>
tag.</p>
<p>it is text which has body as parent</p>
</card></wml>


thiabek
-- 
http://fastmail.fm : send your email first class

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.