[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xslt pagnation help...

Subject: Re: xslt pagnation help...
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Sat, 10 Aug 2002 00:37:31 +0200
xslt option
I don't know exactly what your problem is, but I would suggest merging the both email message types:

<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
version='1.0' >
<xsl:output doctype-system='http://www.wapforum.org/DTD/wml_1.1.xml'/>

<!-- declare param -->
<xsl:param name="Page" select="0" />
<xsl:param name="PageSize" select="5" />

<!-- start from here -->
<xsl:template match="/">
<wml>
<card id="message">
<p>
<select name="MAILMSGCONTENT" title="MAILMSGCONTENT">
<xsl:apply-templates select="tm_email_client/email_session_config"/>
<option onpick="#card">More</option>
</select>
<a href="#reply">Select</a>
<anchor>Back<prev/></anchor>
</p>
</card>
</wml>
</xsl:template>


<xsl:template match="email_session_config">
<xsl:for-each select="( user_email_msgs/email_msg | default_email_msgs/email_msg ) [position() > ($Page * $PageSize)] [position() &lt;= $PageSize]">
<option value="{em_msg_subj}">
<xsl:value-of select="em_msg_subj"/>
</option>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>


Explanation for the for-each statement:

Select all user_email_msgs/email_msg and all default_email_msgs/email_msg and create a UNION of these both node sets (=> 1 node set). From this merged node set select all elements, whose position() is greater than 0 (on page 0) or 5 (on page 1) and so on (first predicate). From the rest (position() is calculated again) select all the elements whose position() id less than or equals 5, so 5 elements are selected (or less on the last page).

Does this stylesheet what you want??

Regards,

Joerg


Zoe Peng wrote:
Hi, I have an email service(xml document) which I'll allow user to select pre-defined messages as email subject when user doing the reply function
(in wml that transform from xslt). The question for me is I have too much pre-defined message that I want to pagnation them. The pre-defined messages will includes two parts which are user pre-defined and default. I got problem when I have want to click [[More]] to have next page if I devide item into 5. Please help. Thanks. --Zoe


--xsl: <?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0' >
<xsl:output doctype-
system='http://www.wapforum.org/DTD/wml_1.1.xml'/>


    <!-- declare param -->
    <xsl:param name="Page" select="0" />
    <xsl:param name="PageSize" select="5" />

<!-- start from here -->
<xsl:template match="/">
<wml>
<card id="message">
<p>
<select name="MAILMSGCONTENT" title="MAILMSGCONTENT">
<xsl:for-each select="tm_email_client/email_session_config/user_email_msgs/email_msg">
<xsl:if test="position() >= ($Page * $PageSize) + 1">
<xsl:if test="position() &lt;= $PageSize + ($PageSize * $Page)">
<xsl:variable name="_usr_em_msg_subj">
<xsl:value-of select="./em_msg_subj"/>
</xsl:variable>
<option value="{$_usr_em_msg_subj}">
<xsl:value-of select="$_usr_em_msg_subj" />
</option>
</xsl:if>
</xsl:if>
</xsl:for-each>


<xsl:for-each select="tm_email_client/email_session_config/default_email_msgs/email_ms
g">


<xsl:if test="position() >= ($Page * $PageSize) + 1">

<xsl:if test="position() &lt;= $PageSize + ($PageSize * $Page)">
<xsl:variable name="_def_em_msg_subj">
<xsl:value-of select="./em_msg_subj"/>
</xsl:variable>
<option value="{$_def_em_msg_subj}">
<xsl:value-of select="$_def_em_msg_subj" />
</option>
</xsl:if>
</xsl:if>
</xsl:for-each>
<option onpick="#card">More</option>
</select>
<a href="#reply">Select</a>
<anchor>Back<prev/></anchor>
</p>
</card>
</wml>
</xsl:template>
</xsl:stylesheet>



--xml
<?xml version="1.0"?>
<!-- <!DOCTYPE tm_email_client SYSTEM 'http://localhost/xml/dtd/tm_email_client.dtd'>-->
<tm_email_client statuscode="0" statusdesc="Mail has been read." action="emailreply">
<email_session_config>
<user_email_msgs usr_id="user1">
<email_msg>
<em_msg_subj>Are you testing?</em_msg_subj>
</email_msg>
<email_msg>
<em_msg_subj>How are you doing?</em_msg_subj>
</email_msg>
</user_email_msgs>
<default_email_msgs>
<email_msg>
<em_msg_subj>Yes</em_msg_subj>
</email_msg>
<email_msg>
<em_msg_subj>No</em_msg_subj>
</email_msg>
<email_msg>
<em_msg_subj>Please call</em_msg_subj>
</email_msg>
<email_msg>
<em_msg_subj>Pick Up Groceries</em_msg_subj>
</email_msg>
<email_msg>
<em_msg_subj>Call Home</em_msg_subj>
</email_msg>
<email_msg>
<em_msg_subj>Contact School</em_msg_subj>
</email_msg>
<email_msg>
<em_msg_subj>Check Post Box</em_msg_subj>
</email_msg>
<email_msg>
<em_msg_subj>Call Office</em_msg_subj>
</email_msg>
<email_msg>
<em_msg_subj>Appointment Due</em_msg_subj>
</email_msg>
<email_msg>
<em_msg_subj>Appointment Cancelled</em_msg_subj>
</email_msg>
<email_msg>
<em_msg_subj>Busy</em_msg_subj>
</email_msg>
<email_msg>
<em_msg_subj>Will Call Later</em_msg_subj>
</email_msg>
<email_msg>
<em_msg_subj>Call you back</em_msg_subj>
</email_msg>
</default_email_msgs>
</email_session_config>
</tm_email_client>


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.