Subject: Re: [xsl] Re:Re:How to simplify the xslt expression for multiple conditions. From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Sun, 20 May 2001 15:41:11 +0100 |
Hi Yang, > 1. How to pass RTF around to the javascript function? I'm sorry - I don't quite get what you're doing here. Are you saying that now, rather than passing the name of an XML file into the Javascript function, you need to pass some generated XML? If so, you need to serialise that XML and escape it to create a valid Javascript string. Actually I do this in the svg-utils utility - have a look at http://www.jenitennison.com/xslt/utilities/svg-utils.xsl for some templates that you can use. > 1 I am using msxsl3. There is no problem for me using > msxsl:node-set() extension functions to convert RTF to a node set. > But I wonder is EXSLT - Functions with the coming msxml4 or not? Not at the moment. Who knows whether Microsoft will adopt EXSLT in the longer term... > 2 Jeni, I can not figure out the phrase quoted as in your reply; > ***Even better would be if the first pass could be done earlier in > the process, so that the XSLT stylesheet only gets the information > that it actually needs to process, and not loads of extra stuff that > it isn't interested in.** > > Would you plase be more specific, thanks. Now I am interpreting it > to normalize the attribute data when copy-of into RTF..etc. Usually when people have a vocabulary that includes elements named 'rowset' and 'row', they're generating the XML dynamically from a database. So I assume that you are as well. Databases are built to be efficient at retrieving information based on multiple parameters; XPath's pretty good, but it's not fantastic, and XSLT processors cope a lot better with small documents than large ones. Generally, then it's more efficient overall if you get the database to return the information that you're interested in, then process that, rather than having it return everything and try to filter it to get the stuff you're actually interested in. This might not be the case in your application, though, if the parameters that you use to filter the data are things that the user sets dynamically, so you're filtering the same information over and over again, client side. > 3. by following the idea to work on predicate expression from > > [substring(@SalesOrderNo[$dayID], 12, 2) = $dayID] > > to number function as > [number(substring(@SalesOrderNo[$dayID], 12, 2))= number($dayID)] > > it does not work , unless > [not($dayID) or number(substring(@SalesOrderNo[$dayID],12, 2)) = > number($dayID)] > do I misinterpret the logic? Kinda. If $dayID is an empty string, then the first argument to the substring() is an empty node set, and the substring() call returns an empty string. That gets turned into a number - NaN. Similarly, $dayID (the empty string) gets converted into NaN. Somewhat unfortunately, NaN != NaN by definition, so it returns false. You could do: string(number(substring(@SalesOrderNo[$dayID], 12, 1)) = string(number($dayID)) instead, as then 'NaN' will equal 'NaN', but you may as well just do: not($dayID) or number(substring(@SalesOrderNo, 12, 2))) = number($dayID) instead. 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re:Re:How to simplify the xsl, Yang | Thread | RE: [xsl] Re:Re:How to simplify the, Yang |
Re: [xsl] Control over html output, David Carlisle | Date | Re: [xsl] Control over html output, Jeni Tennison |
Month |