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

Re: Global Variable

Subject: Re: Global Variable
From: Mike Brown <mike@xxxxxxxx>
Date: Thu, 15 Aug 2002 00:59:33 -0600 (MDT)
global variable xpath
aruniima.chakrabarti@xxxxxxxxxxxxxxxxxx wrote:
> I was trying something like this... but this won't really work as I want the
> node-list in the param.... Any ideas???
> 
> <xsl:param name="Path" select="'p_ptr_str_ln_txn_inq_com'"/>
> 
> <xsl:variable name="xpath">
> 	<xsl:choose>
> 		<xsl:when test="string-length($Path) != 0">

"string-length($Path) != 0" is longhand for just "$Path" (try it)

> 			<xsl:value-of select="//Header/*[name()=$Path]"/>
> 
> 		</xsl:when>				
> 		<xsl:otherwise>
> 
> 				<xsl:value-of select="//Header"/>
> 
> 
> 		</xsl:otherwise>				
> 	</xsl:choose>			
> </xsl:variable>

You want xsl:copy-of, not xsl:value-of, (value-of means 'create a text node
from the string-value of this object, in this case the first node in this 
node-set' ... whereas copy-of means 'copy this node-set')

Then $xpath will be a result tree fragment. To access it as a node-set you
will need to convert it to a node-set by passing it as an argument to the
exsl:node-set() extension function or your XSLT vendor's equivalent extension
function (check the docs).

<xsl:variable name="xp-nodeset" select="exsl:node-set($xpath)"
  xmlns:exsl="http://exslt.org/common" />

   - Mike
____________________________________________________________________________
  mike j. brown                   |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  resume: http://skew.org/~mike/resume/

 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.