Search

Has anyone succeeded in multi-pass processing templates (do this, then do that with the results) without using external node-set functions?

I figured it could work like this, but with no success so far:

<xsl:template match = "/">
<xsl:variable name = "phase1">
<xsl:apply-templates select = "." mode = "phase1"/>
</xsl:variable>
<xsl:appy-templates select = "$phase1" mode = "phase2"/>
</xsl:template>

xsl:appy-templates

I'm not sure if this might be your problem, but there is a small typo in your template: apply-templates.

thanks, that wouldnt be it, the question is rather how this is different from using node-set as clearly outlined here

The key difference between modes and node-set is that modes only allow you to apply multiple templates to the same source xml, while node-set allows you to apply templates on transform outputs as well.

In other words, modes will only allow multiple passes on your original xml, which is much less dynamic than being able to apply templates to the output of other templates.

The problem with your example above is that vanilla xslt1 does not put a true node-set into your result variable, instead it is a result tree fragment (RTF), an idiosyncratic xsl data type. The node-set function was designed to overcome this limitation.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details