p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

xslt thread: Require some HELP


Message #1 by tripathia@r... on Wed, 26 Jun 2002 08:29:54
why i am saying that it is problem with <p> and </p> because when i copy 
that wml which is produced by nokia and place a </p> after COOL PHP and 
remove the </p> from the end  which is before </card> and after saving 
that file it is running in nokia and m3gate.
as you have said  now i have removed that line which has <strong> in it 
and removed disable-output-escaping from <xsl:template match="p"> . now 
the html is

<html>
<!-- test -->
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<title>PHP for All</title>
</head>
<body bgcolor="#ffffff" text="#000040" link="#ff0000" vlink="#800000">
<h2>Cool PHP</h2>

<p>This is some thing related to PHP and sablotron.</p>

<center>
<p><b>Software</b></p>

<div>php has sablotron processor for xslt</div>

<ul>
<li><a href="php/">PHP download mirror</a></li>

<li><a href="PHP-Level/">PHP beta/pre-releases mirror</a></li>
</ul>

<p><b>On Line Help</b></p>

<ul>
<li><a href="http://www.php.net/">PHP Manual</a></li>
</ul>
</center>

<p><a href="http://www.phpbuilder.com/">The unlimited stuff on PHP</a></p>

<p align="right"><i>the PHP Team</i></p>
</body>
</html>

and style sheet 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>
      <xsl:element name="card">
      <xsl:attribute name="title">
      <xsl:value-of select="html/head/title"/>
      </xsl:attribute>
       <p>
       <xsl:apply-templates/>
       </p>
      </xsl:element>
  </wml>
</xsl:template>
   <xsl:template match="head"/>
   <xsl:template match="meta"/>
   <xsl:template match="script"/>
   <xsl:template match="style"/>
   <xsl:template match="body">
     <xsl:apply-templates/>
   </xsl:template>
   
   <xsl:template match="p/div | div/div | center/div | ul/div | a/div">
      <xsl:apply-templates/>
      </xsl:template>
     
     <xsl:template match="div">
        <p><xsl:apply-templates/></p>
       </xsl:template>
   
   <xsl:template match="p/li | div/li | ul/li | center/li | a/li">
         <xsl:apply-templates/><br/>
   </xsl:template>
   
   <xsl:template match="li">
     <xsl:apply-templates/><br/>
    </xsl:template>			
  
  
  <xsl:template match="p/ul | center/ul | div/ul | ul/ul | a/ul">
  	 <xsl:apply-templates/>
  </xsl:template>
  
  <xsl:template match="ul">
    <p><xsl:apply-templates/></p>
  </xsl:template> 
  	
  	
    <xsl:template match="p/center | div/center | center/center | ul/center 
| a/center">
      <xsl:apply-templates/>
    </xsl:template>
     
     <xsl:template match="center">
         <p align="center"><xsl:apply-templates /></p>
     </xsl:template>   
    
   
    
    	<xsl:template match="a/a | div/a | center/a | p/a | ul/a | li/a">
							
    	  <xsl:element name="a">
	    <xsl:attribute name="href">
	      <xsl:value-of select="@href"/>
	      </xsl:attribute>
	      <xsl:value-of select="."/>
              </xsl:element>
    	    </xsl:template>
    	  
    	  <xsl:template match="a">
    	       <xsl:element name="a">
	           <xsl:attribute name="href">
	           <xsl:value-of select="@href"/>
	           </xsl:attribute>
	         <p><xsl:value-of select="."/></p>
	       </xsl:element>
    	  </xsl:template> 
    	   
    	   <xsl:template match="p/p | div/p | center/p | ul/p | a/p">
	   <xsl:apply-templates/>
	   </xsl:template>
	   
	   <xsl:template match="p">
	   <p><xsl:apply-templates/></p>
	   </xsl:template>

     
</xsl:stylesheet>

but it is still giving error
error:3085,line:8,column:XML:invalid child


can you suggest what can i do.

tripathia

  Return to Index