Subject: [xsl] RE: XHTML to WML problem From: Cassandra Bonner <cbonner_98@xxxxxxxxx> Date: Wed, 21 Mar 2001 15:29:11 -0800 (PST) |
Has anyone tried the suggestion by Tom Myers (using XSLPrune)? If so - did this work successfully? We are experiencing the same issue that Mark posted and are contemplating using this solution, but would like some feedback. Another idea we have is to force "rows" of a specified byte size into our xml doc as follows. As Mark, we would like to put out the maximum amount of text a device can handle, as usability tests have shown this is easiest for our users. (we're contemplating mapping the main user agents to "profiles" with their own stylesheet as described in Profession WAP by wrox, but that's a side note). This is an ugly solution, and often times the max num of bites will not be met as not every line will contain the specified size (at the end of elements). E.g.XML - each a specified size (e.g 10 bytes) <news @pubdate='19-2-1999' @count> <news_id @count> <link @count>http://blah.blah></link> <title @count>blah meets blah</title> <desc @count>blah blah blah</desc> <story> <line @count>blah blah blah blah</line> <line @count>blah blah blah blah</line> </story> </news_id> </news> pseudo code that hasn't been tested... <xsl:stylesheet blah blah> <!-- skipping... --> <!-- set up variable to count the # of "rows" a much better way of doing this.. just a first pass --> <xsl:variable name="total" select = "//[@count]"> <xsl:for-each select="news_id"> <p><xsl:value-of select ="title"/></p> <!-- skipping --> <xsl:for-each select="line"> <xsl:if test="count($total)<55> <!--limits to max 550 bytes if each "row" is 10 leaves remaining space for "footer" could vary per "profile" for different user agents and have a java call to make this dynamic --> <xsl:value-of select="."/> </xsl:if> </xsl:for-each select="line"> <!-- rest of doc --> </xsl:for-each> </xsl:stylesheet> Just threw this together so likely has flaws but the logic could potentially limit per # of bytes as req'd. Has anyone tested the XSLPrune solution, and does this do something like this in a cleaner way? thanks in advance, cass >Date: Tue, 30 May 2000 11:08:36 +0100 >From: Mark Lynch <Mark.Lynch@xxxxxxxxxxxxxxx> >Subject: XHTML to WML problem > >Hi all, >I want to convert an XHTML document to WML and deliver it to a WAP device. >However there is a limitation on the amount of information that can be sent >down to the WAP device - on Nokia 7110 I thinks its about 1.4Kb. I use XSLT >to convert to WML. I then need to break down this file into 1.4Kb chunks. >Has anybody out there done anything like this? A related problem which _may_ be helpful...in Ch 19 of "Professional JSP" (Wrox, just out at http://www.amazon.com/exec/obidos/ASIN/1861003625) you'll see one way of emergency-pruning of XSL output for WML limits. (The chapter is "Case Study: Weather with JSP, XSLT, and WAP", fwiw.) For instance, on page 682 there's <xsl:value-of select="pruner:prune($theSessionID,string($Zip),$Plim)"/> which turns out to mean "try to produce the zip code as pulled from the last database query of this httpSession, but don't go past a total of $Plim output characters since the last reset (which happens once per request). Notice that here we're pruning content, not tags, all tags are always produced; the actual output content will depend on the order of XSL evaluation, but correctness will not. (public class XSLPrune is on pp674-675; it's not complicated.) If you have trouble with it, tell me :-) 'cos my co-author, Sasha Nakhimovsky, isn't on this list. (Nor is he on the amazon list of authors; they always mess up somewhere.) BTW, I've since learned how to do the XSL much better, but not in any way that affects the pruning issue. It does work, but I would love to see a simpler approach, and I don't know how it would apply to your problem; not directly, of course. I suspect that the best approach to your problem is going to depend on the specifics of the problem; feel free to post more details. :-) Tom Myers __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xsl 1.1 security model?, Francis Norton | Thread | [xsl] special char in html textarea, Sylvia Lowden |
RE: [xsl] Problem with html input t, Ciaran Byrne | Date | RE: [xsl] Problem with html input t, Ciaran Byrne |
Month |