[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: Wed, 30 May 2001 10:47:06 +0100
javascript string size
Hi Sun-fu,

> 1 The js-escape template seems to omit the xml-declaration while
> producing the serialised XML. Since a part of xml is related to BIG5
> , I must have this PI built in, such as <?xml version="1.0"
> encoding="big5"?> What is remedy to js-escape template?

This is to do with the serialiseXML template (whose results are sent
as a parameter to the js-escape template).  I'm afraid that I'm at a
bit of a loss when it comes to how you should be using the XML
declaration at this point, as the XML string that you're creating is a
JavaScript string, and the encoding that you declare in the XML
declaration within it shouldn't (I think) make much of a difference.
If you do need to add one, you could try adding the template:

<xsl:template match="/" mode="serialise">
   <xsl:text>&lt;xml version="1.0" encoding="big5"?></xsl:text>
   <xsl:apply-templates mode="serialise" />

It's more likely that the problem is that the simple serialisation
templates won't escape any characters using character entities, which
is something you might need to do. You could try looking at the
serialisation templates that Evan Lenz announced recently
(http://xmlportfolio.com/xml-to-string/) - I haven't looked at them,
but they may be more sophisticated and able to handle escaping.

Otherwise, unless someone else can come up with a better idea, you're
probably going to have to rework your approach.  Rather than having a
serialised string in the output, you could have an XML 'data island'
in the HTML page that you access and transform when you need to.
Chris Bayes will be able to help you with that...

> 2. It seems to me there is size limitation when using serialized XML
> as javascript augument. To prove this point, I keep adding **line**
> element into xml file. At certain point, the page change function
> becomes unfunctional and look like to be locked. Could you see what
> is caused. xml, xsl are listed below for fyi.

Could well be - might be a limit on the JavaScript string size.  I'm
afraid I don't see a way around that.

Actually I'm tempted to say that you should modify your application on
a wider scale.  Rather than having some large piece of XML that you
filter, and then trying to pass the filtered XML around, retrieve and
use the filtered piece of XML all the time - have it as a file on your
file system, or have a server-side script that generates it rather
than trying to do everything on the client.

>>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 have a hard time to understand what is the phrase saying: ** you
> could the hardcode it into the definition of .... *** Are you
> suggesting that once I loadXML xml doc., and saved it as a global
> variable, then when doing the sequent paging, only I have to do is
> to use .addparam for new page number and display the output.

Yes. The point of functions taking arguments is that the arguments
change each time they're called. When you use the changePageXML
function, you are always passing the same value for the second
argument (the XML string) and the third argument (the XSLT
stylesheet). Rather than having them as arguments, you could fix them
as global variables or within the function definition. So rather than:

   function changePageXML(number,xmlfile,xslfile,pageParam,space) {

You could have:

   xmlfile = '...';
   xslfile = '...';

   function changePageXML(number, pageParam, space) {

I hope that helps,


Jeni Tennison

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

Current Thread


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.
First Name
Last Name
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.