Re: what are node set fragments and why are they ruining my life?

Subject: Re: what are node set fragments and why are they ruining my life?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 15 Dec 1999 10:38:40 GMT
> - Phil Lanch and David Carlisle suggest using
> <xsl:for-each select="xt:node-set($members)">

well I said that this extension could be used to get back a node set,
but probably (if I understood quite what you want to do, which I don't)
you wouldn't need this as you could avoid building a result tree
fragment too early (which appears to be your problem)

> But even though I can do a <xsl:copy-of select="$members"/> in the main template,
> <xsl:for-each select="$members"> gives me a "cannot convert to node-set" error,

That's to be expected.

> and <xsl:for-each select="xt:node-set($members)"> has only 1 loop
> pass, not 2.
well node-set isn't standard of course, but probably it is putting a
root node on it, so in that case you probaly want
  "xt:node-set($members)/*"

> I have a god-awful select expression that I want to re-use in various
> places. I could use an ENTITY, but i'd rather just modularize by
> using a call-template 

so why not just do that?

If you have

<xsl:template name="god-awful">
  <xsl:apply-templates
     select="foo|a/b[@xx]/c[@aa and @dd='this']|aa[dd[cc]]"/>
</xsl:template>


then you can just use

<xsl:call-template name="god-awful"/>

whenever you want to do an apply based on that select expression in some
other template.

David


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


Current Thread