Re: [xsl] XHTML to WML transformations problems.

Subject: Re: [xsl] XHTML to WML transformations problems.
From: omprakash.v@xxxxxxxxxxxxx
Date: Tue, 23 Aug 2005 14:47:21 +0530
Hi,
         Looks like you would like your divs replaced by <p>s. The
following stylesheet should do that.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:html="http://www.w3.org/1999/xhtml"; exclude-result-prefixes="html">>

<xsl:output method="xml" indent="yes" doctype-public="-//WAPFORUM//DTD WML
1.3//EN" doctype-system="http://www.wapforum.org/DTD/wml_1.1.xml"/>

  <xsl:template match="/">
  <wml>
    <card id="card1" title="{head/title}">
    <option>
            <xsl:apply-templates select="html:html/html:body/html:div"/>

    </option>
    </card>
  </wml>
  </xsl:template>

    <xsl:template match="html:div[@id='sidebar']">
      <p>
      <xsl:apply-templates />
      </p>
  </xsl:template>

<xsl:template match="html:a">

      <xsl:element name="a">
<xsl:for-each select="@*">
<xsl:attribute name="{name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates />
</xsl:element>

  </xsl:template>

  <xsl:template match="html:div[@id='second']">
  <p>
<xsl:apply-templates />
  </p>

  </xsl:template>

  <xsl:template match="html:h1|html:p">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>

  </xsl:template>

  </xsl:stylesheet>


Cheers,
prakash








                                                                                                                                
                      "Paul Healy"                                                                                              
                      <sebalut@hotmail         To:      xsl-list@xxxxxxxxxxxxxxxxxxxxxx                                         
                      .com>                    cc:      (bcc: omprakash.v/Polaris)                                              
                                               Subject: Re: [xsl] XHTML to WML transformations problems.                        
                      08/23/2005 02:05                                                                                          
                      PM                                                                                                        
                      Please respond                                                                                            
                      to xsl-list                                                                                               
                                                                                                                                
                                                                                                                                




The first <div> elements will be used to create links in a list at the top
of the page. I want to organize the second div elements into a paragraph
<p>..</p> containing the <h1> and <p> text node from the source XML
document. I want to organise the page something like this.
<wml>
<card>
<p>
<a>...</a> <br/>
<a>...</a> <br/>
<a>...</a>  <br/>
</p>
<p>...</p>
</card>
</wml>


>From: omprakash.v@xxxxxxxxxxxxx
>Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>Subject: Re: [xsl] XHTML to WML transformations problems.
>Date: Tue, 23 Aug 2005 12:57:13 +0530
>
>
>
>
>
>
>Hi,
>       Can you be more clear on what your requirement is. You have given
>the
>input xml but you haven't told what the desired output is.
>
>What would you like me to do with the second part.
>
>Cheers,
>prakash
>
>
>
>
>
>
>
>                       "Paul Healy"
>                       <sebalut@hotmail         To:
>xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>                       .com>                    cc:      (bcc:
>omprakash.v/Polaris)
>                                                Subject: Re: [xsl] XHTML
to
>WML transformations problems.
>                       08/23/2005 12:33
>                       PM
>                       Please respond
>                       to xsl-list
>
>
>
>
>
>
>Thanks a lot for that mate it was really useful and I am very grateful. It
>doesnt however allow the use of <a href> as children in <option> tags so I
>need to somehow change it to create <br/> tags after each <a href> element
>tag in the source document to create a new line for each <a> tag.
>
><html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
>   <head>
>     <title>XSLT transformations</title>
>     <link rel="stylesheet" type="text/css" href="style.css" />
>   </head>
>   <body>
>     <div id="index">
>       <ul>
>         <li><a href="index.html">Home</a></li>
>         <li><a href="products.html">Product Page</a></li>
>         <li><a href="Offers.html">Offers</a></li>
>       </ul>
>      </div>
>      <div id="second">      <---I have added in a second part to the
>source
>
>document--->
>       <h1>This is the second part</h2>
>         <p>Eventually it will be done</p>
>       </div>
>   </body>
></html>
>
>Can the XSL sheet be extended to include the second <div> element? I have
>nearly got it just need a tiny bit more help. Thank you very much for your
>reply I appreciate greatly the effort you have put into this and am
>eternally grateful.
>
>_________________________________________________________________
>Want to block unwanted pop-ups? Download the free MSN Toolbar now!
>http://toolbar.msn.co.uk/
>
>
>
>
>
>This e-Mail may contain proprietary and confidential information and is
>sent for the intended recipient(s) only.
>If by an addressing or transmission error this mail has been misdirected
to
>you, you are requested to delete this mail immediately.
>You are also hereby notified that any use, any form of reproduction,
>dissemination, copying, disclosure, modification,
>distribution and/or publication of this e-mail message, contents or its
>attachment other than by its intended recipient/s is strictly prohibited.
>
>Visit Us at http://www.polaris.co.in
>

_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger 7.0 today!
http://messenger.msn.co.uk





This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. 
If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.

Visit Us at http://www.polaris.co.in

Current Thread