cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin J Walters <kevin.walt...@msdw.com>
Subject Re: Dynamic WAP problems
Date Wed, 23 Aug 2000 23:43:57 GMT

Matt Coolidge wrote:
> 
> Hi everyone. I'm writing a WAP application. Basically, my XSP talks to the
> database and sticks the resulting DocumentFragment into the output. I can
> write an XSL stylesheet to make a WAP deck, with a card for each row of
> data. But it's FAR too big if I do it this way; and WAP phones error out on
> it.

s> Welcome in the marvelous world of WAP :-(

s> Currently, there isn't an easy way to split data without doing a query
s> everytime. You can write a proxy with XSP, but it's really expensive.

s> You need to tell cocoon which page you want. You can add
s> a parameter to your query, like 'mytodo.xsp?page=4'. Cocoon
s> cache will not work on this as the query is alway different.

I had to 'solve' this and went for a page argument. I retrieve all the
data from the database, produce some xml where the thing i know will
be large will be cut up by a non-word breaking java function. I'm
lucky in that i'm only pulling a few K from the database...

I also pass the cgi args through to the wml via,

<root>
  <text>
    <page>lump1</page>
    <page>lump2</page>
    <page>lump3</page>
  </text>
     <Args>
       <xsp:logic>

       if (page != null) {
         <page><xsp:expr> page </xsp:expr></page>
       };
       </xsp:logic>
     </Args>
</root>

Then, i have stuff like this to xslt it into wml,

<xsl:variable name="pagetodisplay">
  <xsl:choose>
    <xsl:when test="/root/Args/page">
      <xsl:value-of select="/root/Args/page"/>
    </xsl:when>
    <xsl:otherwise>1</xsl:otherwise>
  </xsl:choose>
</xsl:variable>

<xsl:if test="text/page[position()=$pagetodisplay - 1]">     <!--- whitespace is
important around expression -->
  <p><a href="X.cxml?page={$pagetodisplay - 1}">PREVIOUS PAGE</a></p>
</xsl:if>

<p>
  <xsl:value-of select="text/page[position()=$pagetodisplay]"/>
</p>

<xsl:if test="text/page[position()=$pagetodisplay + 1]">
  <p><a href="X.cxml?page={$pagetodisplay + 1}">NEXT PAGE</a></p>
</xsl:if>

I'd offer this as 'a solution' rather than 'the solution'. It's all
rather tricky if you intend to produce html which will show everything 
and wml which gives you a small view over the data.

It's not 100% either, as i can't strictly determine the size of all my 
data, nor can i easily (?) predict the efficiency of the binary
encoding the gateway will do, and i'm assuming the Nokia 7110 has the
worst limitation?

One trick i meant to implement was to use the variables in WML to make
repeated text use less space. Oh, and watch out for outputing $
symbols, you need to escape them by doubling up if you want a real $.

Criticism welcome as i don't know what i'm doing when it comes to
xsp. I'm concerned over my xslt too, is my xsl:when test 100% correct?
It seems to work?

Also, i wanted to kick some of my java code in the xsp out of the main 
code out of the way, i made some 'methods' which output xsp. To make
this work i had to pass through some variables i found listed in the
cocoon docs - is this pucka and/or likely to change?

private void writeThing(ResultSet rs, 
                         Node xspParentNode,
                         Stack xspNodeStack, 
                         Document document, 
                         Node xspCurrentNode)


regards

|<evin

ps the wml browser limits for those interested,

cheshire ~ $ lynx -dump  'http://wap.colorline.no/wap-faq/?format=html&pair=08.005' |
tail -14
   Browser Compiled WML deck limit
   UP.Browser 3.2 1492 bytes
   UP.Browser 4.x 2048 bytes
   Ericsson R320 Aprox 3000 bytes
   Ericsson R380 Aprox 3500 bytes
   Ericsson MC218 More than 8000 bytes
   Nokia 7110 1397 bytes
       
   [1]Contents
     _________________________________________________________________

References

   1. http://wap.colorline.no/wap-faq/?format=html#contents



-- 
Kevin J Walters                      Morgan Stanley Dean Witter
kevin.walters@msdw.com, kjw@acm.org  750 Seventh Avenue
Tel: 212 762 1752                    New York
Fax: 212 762 0174                    NY 10019

Mime
View raw message