Subject: RE: [xsl] Portability function-available tips From: Dimitre Novatchev <dnovatchev@xxxxxxxxx> Date: Fri, 9 Jan 2004 04:04:26 -0800 (PST) |
> > > Dimitre has a version of msxml that supports exsl, > > > alternatively I believe you can put in an msxsl script > > > element that will be ignored by other processors but which > > > implements exsl:node-set (essentially just needs to be an > > > identity function) > > > > > > David > > > > Ahhh excellent - exactly the kind of thing I was looking for, > > thanks David > > Hmmm, maybe it wasn't :) > > Or at least, I can't see how to take advantage of it. > > As an example, I currently build a temporary tree and convert it to a > node-set: > > <xsl:variable name="foo-rtf"> > <xsl:apply-templates mode="build"/> > </xsl:variable> > <xsl:variable name="foo" select="exsl:node-set($foo-rtf)"/> > > I then use that variable in several places by using: > > <xsl:for-each select="$foo"> > <xsl:apply-templates/> > </xsl:for-each> > > The only way I can see of making the stylesheet portable is to replace > all occurances of the above for-each, with this choose/when: > > <xsl:choose> > <xsl:when test="function-available(msxml:node-set)"> > <xsl:for-each select="msxml:node-set($foo-rtf)"> > <xsl:call-template name="foo-template"/> > </xsl:for-each> > </xsl:when> > <xsl:when test="function-available(exsl:node-set)"> > <xsl:for-each select="exsl:node-set($foo-rtf)"> > <xsl:call-template name="foo-template"/> > </xsl:for-each> > </xsl:when> > <xsl:otherwise> > <xsl:call-template name="error"/> > </xsl:otherwise> > </xsl:choose> > > Not only that, but to avoid code duplication I need to separate out the > body of the for-each into a named template - which is even more code. > > How can I integrate the msxml:script idea to avoid using > function-available? This is simply not necessary -- just use exslt:node-set(). At present I am working with the following 9 XSLT processors all of which implement exslt:node-set(): MSXML4 (3rd party implementation -- download at: http://sf.net/projects/fxsl) .Net xsltTransform (3rd party implementation -- download at: http://www.gotdotnet.com/Community/Workspaces/Workspace.aspx?id=201eb290-5bf0-4452-9bf7-d21d39268f36 ) Saxon6.5.3 Saxon 7.8 JD XalanJ 2.4.1 and later XalanC 1.5 xsltProc 4xslt These are just the 9 XSLT processors I'm working with on a daily basis. Probably there are even more processors with EXSLT support. > > (ps is this the way that everyone keeps there stylesheet portable?) As noted above, just using exslt:node-set() is what allows me to develop and support a single version of FXSL. Dimitre Novatchev. FXSL developer http://fxsl.sourceforge.net/ -- the home of FXSL Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html __________________________________ Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Portability function-avai, Michael Kay | Thread | RE: [xsl] Portability function-avai, Andrew Welch |
RE: [xsl] Portability function-avai, Andrew Welch | Date | Re: [xsl] Portability function-avai, David Carlisle |
Month |