Xml transformation to wml

  • 13 years ago
    Hallo All,

    I am working on a project for consuming content in mobile devices. I need to transform the xml into wml using xslt. In my xml I have the content between styles like: <style><div>....my content</style></div> to display the content on mobile devices , the browser displaying like <style><div>....my content</style></div> , how can i skip those tags or is there any possiblity of using styles in WAP 1.0.

    I have found in my xml, the content that i wanted to display in the mobile device is with in <!CDATA[[ and ]]>. I could not understand how can I transform the xml by skipping the <!CDATA[[ and ]]> to wml. Please tell me if you have any ideas.

    my code that I was talking about is here:

    topic.xml

    <?xml version="1.0" encoding="utf-8"?>
    <Topic id="ee35444646fa410f002572c000371504" title="Introduction" parentId="" level="1" docNo="2">
      <Ancestors>
      </Ancestors>
      <PublicationMetadata>
      </PublicationMetadata>
      <TopicMetadata>
      </TopicMetadata>
      <Bookmarks>
        <BookmarkEntry name="_Toc378851409" value="Introduction" />
        <BookmarkEntry name="_Toc410305900" value="Introduction" />
        <BookmarkEntry name="_Toc517531790" value="Introduction" />
        <BookmarkEntry name="_Ref517770118" value="Introduction" />
        <BookmarkEntry name="_Ref517770217" value="Introduction" />
        <BookmarkEntry name="_Ref517770264" value="Introduction" />
        <BookmarkEntry name="_Toc517852098" value="Introduction" />
      </Bookmarks>
      <TopicIndex>
        <IndexEntry value="feature" />
        <IndexEntry value="legacy" />
      </TopicIndex>
      <TopicContent><![CDATA[<style type="text/css">
     span.Kommentarzeichen  { font-family:'Times New Roman'; font-size:8pt; }
     span.Funotenzeichen  { font-family:'Times New Roman'; vertical-align: 'super'; }
     div.berschrift1  { margin-top:12pt; margin-bottom:15pt; font-family:'Arial'; font-size:16pt; font-weight:bold; }
     div.Textkrper  { margin-top:3pt; margin-bottom:1pt; font-family:'Times New Roman'; font-size:11pt; }
     div.Standard  { font-family:'Times New Roman'; font-size:10pt; }
    ins {color:blue}
    del {color:red}
    </style>
    <div class="hn_content" xmlns:v="urn:schemas-microsoft-com:vml"><!--[if gte IE 5.5000]><script type="text/javascript" src=""></script><![endif]--><div class="Textkrper"><span class="hn_para"> This document provides an introduction of some of the more important features of Hyper.Net, and also to serve as an example document for publishing on the Hyper.Net Live Demo Site.</span></div>
      <div class="Textkrper"><span class="hn_para">Many word formatting conventions have been used in the formatting of this document so that it is easy to demonstrate the features Hyper.Net specifically provides to process legacy <a class="hn_commentsymbol" name="CommentSymbol_Comment7" href="http://www.developerfusion.co.uk/forums/AddPost.aspx?ForumID=20#CommentContent_Comment7" onmouseover="return PopupShow('Comment7',event)" onmouseout="return PopupHide(event)" onclick="return false;"><span class="hn_commentsymbol" style="text-decoration:none;color:#000033;font-size:x-small">[CS1]</span></a>documentation, which is almost always formatted for paper appearance, and often contains &nbsp;structure, inconsistent formatting, and inconsistent use of styles.<span class="Funotenzeichen"><a class="hn_footnotesymbol" name="FootnoteSymbol_Footnote1" href="http://www.developerfusion.co.uk/forums/AddPost.aspx?ForumID=20#FootnoteContent_Footnote1" title="Footnote"><span class="hn_footnotesymbol" style="text-decoration:none;color:#003300;font-size:x-small"><sup>1</sup></span></a></span></span></div><br clear="all"><hr align="left" size="1" width="33%">
      <table class="hn_footnote" cellpadding="0" cellspacing="0" border="0">
        <tr class="hn_footnote">
          <td class="hn_footnote" width="1%" valign="baseline" style="padding-right:6pt"><a class="hn_footnotesymbol" name="FootnoteContent_Footnote1" href="http://www.developerfusion.co.uk/forums/AddPost.aspx?ForumID=20#FootnoteSymbol_Footnote1" title="Back"><span class="hn_footnotesymbol" style="text-decoration:none;color:#003300;font-size:x-small"><sup>1</sup></span></a></td>
          <td class="hn_footnote" width="99%">
    <div class="Standard"><span class="hn_para"><span class="Funotenzeichen"></span> This is the text in the footnote under introduction.</span></div>
    </td>
        </tr>
      </table><script language="JavaScript" src="" type="text/javascript"></script><div class="hn_comment" style="display:none"><br clear="all"><hr align="left" size="1" width="33%">
      </div>
      <div class="hn_commentsymbol" style="display:none"><a class="hn_commentsymbol" name="CommentContent_Comment7" href="http://www.developerfusion.co.uk/forums/AddPost.aspx?ForumID=20#CommentSymbol_Comment7"><span class="hn_commentsymbol" style="text-decoration:none;color:#000033;font-size:x-small">[CSComment7]</span></a></div>
      <div class="hn_commentcontent" id="Comment7" onmouseover="PopupShow('Comment7',event)" onmouseout="PopupHide(event)" style="display:none; border:1px solid #666666; background-color:#ffffc0; padding:2px; font-size:10pt">
    <div class="Standard"><span class="hn_para"><br><span class="Kommentarzeichen"></span><span class="Kommentarzeichen"></span>Old content authored in old authoring tools.</span></div>
    </div>
    </div>]]></TopicContent>

     topic.xslt

     <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">  
    <xsl:output omit-xml-declaration="yes"/>  
    <xsl:template match="/Topic">  
     <xsl:variable name="unid" select="@id"/>
    <wml>      
        <card id="mainToc" title="Topic_Intr">  
            <p>         
            <!--Previous-->
               <xsl:choose>
                    <xsl:when test="//Topic[@topicId=$unid]/preceding-sibling::Topic[1]">
                        <a href="../{//Topic[@topicId=$unid]/preceding-sibling::Topic[1]/@folder}/topic.wml">Previous</a>
                     </xsl:when>
                     <xsl:when test="//Topic[@topicId=$unid]/parent::Topic">
                         <a href="../{//Topic[@topicId=$unid]/parent::Topic[1]/@folder}/topic.wml">Previous</a>
                     </xsl:when>
                     <xsl:otherwise>Previous</xsl:otherwise>
               </xsl:choose>
               <xsl:text></xsl:text>
               <!--Next-->
               <xsl:choose>
                    <xsl:when test="//Topic[@topicId=$unid]/child::Topic[1]">
                        <a href="../{//Topic[@topicId=$unid]/child::Topic[1]/@folder}/topic.wml">Next</a>
                    </xsl:when>
                    <xsl:when test="//Topic[@topicId=$unid]/following::Topic[1][@type='Topic']">
                        <a href="../{//Topic[@topicId=$unid]/following::Topic[1][@type='Topic']/@folder}/topic.wml">Next</a>
                    </xsl:when>
                    <xsl:otherwise>Next</xsl:otherwise>
               </xsl:choose><br/><br/>
               <hr/>
               <!--Topic title-->
                <b><xsl:value-of select="@title" /></b><br/><br/>
                
                <!--Topic Content -->
                <!--<xsl:value-of select="TopicContent"/>    -->            
            </p>  
        </card>
        <xsl:apply-templates select="TopicContent"/>
     </wml>  
    </xsl:template>
    <xsl:template match="TopicContent">
     <card id="contents" title="Contents">
      <p>
        <xsl:value-of select="."/>
        </p>
     </card>
    </xsl:template>
    </xsl:stylesheet>

     

    Any ideas would be appreaciated.

     

    Thank you,

    Aruna

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Anyone who considers arithmetic methods of producing random digits is, of course, in a state of sin.” - John von Neumann