[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XHTML to WML transformations problems.
Hi, You can get all the links using the following stylesheet: <?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:a"/> </option> </card> </wml> </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:stylesheet> I thought someone suggested you not to use xsl:text to output doctype declaration. ANyway, I have corrected this as well as some namespace issues. Hope this helps. Cheers, prakash "Paul Healy" <sebalut@hotmail To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx .com> cc: (bcc: omprakash.v/Polaris) Subject: XHTML to WML transformations problems. 08/23/2005 05:34 AM Please respond to xsl-list Hi I have rewritten my question as the original post was a mess. I am trying to write a style sheet to convet my source XHTML doc into a WML result document with XSLT. I have tried looking online for resources but unfortunately XHTML to WML is not covered in detail. If anyone could please look through my work and advise me on what to do, I would be very very grateful. This is my source XHTML file. <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="sidebar"> <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> </body> </html> The XSL document is: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" /> <xsl:template match="/"> <xsl:text disable-output-escaping="yes"> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml_1.3.xml"> </xsl:text> <wml> <card id="card1" title="{head/title}"> <option> <xsl:for-each select="body/div/ul/li"> <a href="#{generate-id(a)}"> <br/> <xsl:apply-templates /> </a> </xsl:for-each> </option> </card> </wml> </xsl:template> </xsl:stylesheet> Basically I want to create a WML document from the source XHTML document. This is for a research project and I am currently stuck on this problem. I want to create a list of <a href="#index.wml">Home</a><br/> <a href="#products.wml">Products</a><br/> <a href="#offers.wml">Offers</a><br/> in the result document, that is creating a list of links to three other WML cards. I know this probably doesnt seem very complicated but I have been working for days on it and I still cant figure it out, and my deadline is up in a weeks time. Would be very very grateful if anyone could please provide me with some help. Thanks in advance. _________________________________________________________________ Be the first to hear what's new at MSN - sign up to our free newsletters! http://www.msn.co.uk/newsletters 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|