This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Making groups of N elements --> Photo index


The xx:node-set() extension function is so widely available, and adds to
greatly to the power of XSLT, that many people have decided they will
use it even though it isn't in the standard.

You can either try and maintain portability using run-time code


<xsl:choose>
<xsl:when test="function-available('saxon:node-set()')">
  ..
</xsl:when>
<xsl:when test="function-available('xalan:node-set()')">
 ..

or, probably more simply, add a preprocessing phase that generates the
correct code for the particular processor before compiling.

Michael Kay
Software AG
home: Michael.H.Kay@ntlworld.com
work: Michael.Kay@softwareag.com 

> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com 
> [mailto:owner-xsl-list@lists.mulberrytech.com] On Behalf Of 
> Antonio Fiol
> Sent: 13 June 2002 09:19
> To: xsl-list@lists.mulberrytech.com
> Subject: Re: [xsl] Making groups of N elements --> Photo index
> 
> 
> I am using saxon, packaged for Debian, version 6.4.4.
> 
> In this case, portability is not a main concern, as I will 
> use a script 
> to do the transform "once", and then I'll use the HTML generated 
> document in a browser.
> 
> However, I am developing other things using XSLT, and I am 
> interested in 
> those being portable.
> 
> Portable meaning, at least: saxon + mozilla + IE6.0 (msxml, 
> right version).
> 
> Could any of you point me to a document with portability advice?
> 
> 
> Thank you very much. Your help is so great!!
> 
> 
> Antonio Fiol
> 
> 
> 
> Michael Kay wrote:
> 
> >>Thank you for your advice about the result tree fragments. I
> >>found that 
> >>feature very useful.
> >>
> >>What is xx:node-set() ? Is it something portable?
> >>    
> >>
> >
> >It's an extension function that's available in nearly every XSLT 
> >processor, though the namespace varies which makes it non-portable. 
> >Several processors support the EXSLT namespace (see www.exslt.org) 
> >which improves the situation.
> >  
> >
> >>I did it _without_ that function, as follows (comments welcome).
> >>
> >><xsl:variable name="allphotos"> <xsl:apply-templates
> >>select="/fotos/foto" mode="identity"> <xsl:sort 
> >>order="ascending" select="@id" data-type="number" /> 
> >></xsl:apply-templates> <foto id="100000000000" dummy="logo" 
> >>src="logo.gif" href="http://homepage"; /> <foto 
> >>id="100000000001" dummy="yes" /> <foto id="100000000002" 
> >>dummy="yes" /> <foto id="100000000003" dummy="yes" /> <foto 
> >>id="100000000004" dummy="yes" /> <foto id="100000000005" 
> >>dummy="yes" /> <foto id="100000000006" dummy="yes" /> <foto 
> >>id="100000000007" dummy="yes" /> </xsl:variable>
> >>
> >>  <xsl:for-each select="$allphotos/foto[(position() mod 8) =
> >>1 and not(@dummy='yes')]">
> >>    
> >>
> >
> >Then you're using a processor that implements the "implicit 
> conversion 
> >of result tree fragments to node-sets" offered by the XSLT 
> 1.1 and XSLT 
> >2.0 working drafts: this code isn't legal in XSLT 1.0. Which 
> processor, 
> >might I ask?
> >
> >(Saxon allows this, provided your stylesheet specifies 
> version="1.1" or 
> >later. But some earlier versions of Saxon allowed it regardless).
> >  
> >
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]