[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Root when the current node is part of Parameter Re

Subject: RE: 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
RE:  Root when the current node is part of Parameter Re
> -----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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.