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

Re: how to store node in variable?

Subject: Re: how to store node in variable?
From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx>
Date: Thu, 21 Oct 2004 21:16:30 +0100
xslt store variable
----- Original Message ----- From: "John" <john-xsl-list@xxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, October 21, 2004 8:39 PM
Subject: how to store node in variable?

Sorry to trouble the list with this one which seems so simple and yet somehow I am banging my head against the wall for hours and I can't even think what to search for. The worst part is I think I've done this before...

How do I store a reference to a node in a variable or what am I doing wrong? Here is what I have (maybe oversimplified) :

<xsl:variable name="me">
    <xsl:when test="<some condition>">
      <xsl:copy-of select=".." />
      <xsl:copy-of select="." />
</xsl:variable> <xsl:call-template name="<some template>">
  <xsl:with-param name="myid" select="$me/@id" />

The with-param is always throwing an error, expression should result in a node-set.

If I add msxsl:node-set around my selects in the variable definition I get cannot convert result tree fragment to node-set.

Alternatively, is there any way to explicitly set the context node without using for-each?

Again my apologies.


In XSLT 1 I believe you need to covert $me to a node-set using an extension function. In version 2 you can use the variable directly or simplify the code to use an XPtah expression like "if <some condition> then . else .."



Current Thread


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.
First Name
Last Name
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.