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

Re: Re:Re:How to simplify the xslt expression for mult

Subject: Re: Re:Re:How to simplify the xslt expression for multiple conditions.
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Mon, 28 May 2001 21:57:43 +0100
xsl mult function
Hi Sun-fu,

> As your suggestion, I use two step approach to render the xml file,
> the frist one is to filter out the data based on a set of multiple
> condition and stored in a RTF. Then Using the RTF to diplay the
> content. Because there are couple of hundred lines, I apply Chris
> Bayes paging example to get the paging capability. During each
> paging process, I try to repeat using RTF, not the original xml file
> to process the output. However I can not get any further and hope
> you can provide some direction from here.

OK, for each page, you want to be transforming the same (filtered) set
of XML.  To pass the XML that you're using from one page to the next,
you need to serialise it and use it as the source of the
transformation to get the next page.

The changePage function takes an XML string as the second argument
(ignore the fact that it's called "xmlfile" - it's used as an XML
string, loaded with loadXML() rather than load()). In the function,
this XML is loaded into a document to create a DOM, and then
transformed:

   function changePage(number, xmlfile, xslfile){
      XMLDOM = new ActiveXObject('Msxml2.FreeThreadedDOMDocument');
      XMLDOM.async = false;
      XMLDOM.loadXML(xmlfile);
      ...
      XSLTProcessor.input = XMLDOM;
      ...
   }

So you can call it with something like:

  changePage(2, '<foo>...</foo>', 'style.xsl')

and it will show you page 2 of the source XML you're passing as the
second argument.

So, in the call to changePage(), you need to pass the serialised XML
that you want to transform as the second argument.  You don't show the
part where you do it; it needs to looks something like:

  changePage(<xsl:value-of select="$pagenumber + 1" />,
             '<xsl:call-template name="js-escape">
                <xsl:with-param name="string">
                   <xsl:call-template name="serialiseXML">
                      <xsl:with-param name="originalDoc"
                                      select="/" />
                   </xsl:call-template>
                </xsl:with-param>
              </xsl:call-template>',
             'style.xsl');

Note that the serialised XML has to be escaped so that it's correctly
parsed as a Javascript string.

In fact, since you *always* want the second argument to be this
particular set of XML, you could hardcode it into the definition of
the Javascript function rather than pass it as a variable.

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 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.