[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Root when the current node is part of Parameter Result Tree Fragement/Nodelist


Subject: RE: [xsl] Root when the current node is part of Parameter Result Tree Fragement/Nodelist
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Tue, 9 Mar 2004 23:34:12 +0100

> -----Original Message-----
> From: Colin Toal
>
> The problem is that - within the context of the ParamColour matching
> template, the key object doesn't seem to be defined - in fact,

Hi,

The actual problem seems to be that your xsl:param is being defaulted to a
string type. Try setting the type to RTF explicitly like:

<xsl:param name="ParamColour"><default /></xsl:param>

Then again, you would need exsl:node-set() or a similar extension function
to pull it off completely...

So to default it to a node-set, try:

<xsl:param name="ParamColour" select="document('')" />

> even root of this context node ( i.e. <xsl:copy-of select="//" /> is only
the
> Parameter contents. This makes me very sad.

Yes, but in the context of the Object template it makes you happy (?) Does
it work in there?

Fact is, in the case of the key, the param evaluated as a string would still
give the correct result, where in the other case you *need* a node-set
(apply-templates).
If you insist on not using extension functions, I'd go for an approach like

<!-- default to empty string -->
<xsl:param name="ParamColour" />
<xsl:param name="ObjectName" />

<xsl:template match="/Objects">
  <FoundObject>
    <xsl:apply-templates select="key('kObject',$ObjectName)" />
  </FoundObject>
</xsl:template>

<xsl:template match="Object">
  <xsl:copy-of select="." />
  <xsl:if test="Colour = $ParamColour">
    Is the same colour!
  </xsl:if>
</xsl:template>


Hope this helps!

Cheers,

Andreas


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



Current Thread