RE: [xsl] Is it possible to modify the source-tree?

Subject: RE: [xsl] Is it possible to modify the source-tree?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 13 Sep 2005 19:31:42 +0100
In an XSLT 2.0 processor (like Saxon 8.x) you don't need the xx:node-set()
call.

You need it with XSLT 1.0 processors. We often call it xx:node-set() because
every vendor has their own name for it: msxsl:node-set() on Microsoft,
xalan:node-set() on Xalan, etc. (sometimes without the hyphen). You need to
look up your vendor's documentation to see what the right name and namespace
is for that processor.

The reason for the extension is that XSLT 1.0 had an unfortunate
restriction: when you define a result tree fragment like this:

<xsl:variable name="x">
  ... some instructions ...
</xsl:variable>

then you aren't allowed to use path expressions to look inside the variable,
e.g. $x//abc. Instead you have to use this extension function and do
xx:node-set($x)//abc. With XSLT 2.0 you can just do $x//abc.

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: Agnisys Technology (P) Ltd. [mailto:agnisys@xxxxxxxxx] 
> Sent: 13 September 2005 19:13
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] Is it possible to modify the source-tree?
> 
> Pardon my ignorance, but I'm not familiar with this 
> "xx:node-set()" call.
> Do I have to use oraxslt2 like David said or can I continue 
> to use Saxon8B?
> 
> Thanks,
> Anupam.
> 
> 
> --- Michael Kay <mike@xxxxxxxxxxxx> wrote:
> 
> > The general approach to writing a multiphase transformation in one
> > stylesheet is
> > 
> > <xsl:variable name="v1">
> >   <xsl:apply-templates select="/" mode="phase1"/>
> > </xsl:variable>
> > 
> > <xsl:variable name="v2">
> >   <xsl:apply-templates select="xx:node-set($v1)" mode="phase2"/>
> > </xsl:variable> 
> > 
> > <xsl:variable name="v3">
> >   <xsl:apply-templates select="xx:node-set($v2)" mode="phase3"/>
> > </xsl:variable>
> > 
> > <xsl:template match="/">
> >   <xsl:apply-templates select="xx:node-set($v3)" mode="phase4"/>
> > </xsl:template>
> > 
> > In 2.0 you don't need the calls on xx:node-set().
> > 
> > So you give these preprocessing templates a mode of 
> "phase1" and invoke the
> > processing as in the example above.
> > 
> > Michael Kay
> > http://www.saxonica.com/
> 
> 
> 
> 		
> __________________________________ 
> Yahoo! Mail - PC Magazine Editors' Choice 2005 
> http://mail.yahoo.com

Current Thread