Subject: Re: [xsl] Global Variable From: Mike Brown <mike@xxxxxxxx> Date: Thu, 15 Aug 2002 00:59:33 -0600 (MDT) |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Global Variable, aruniima . chakrabar | Thread | [xsl] Global Variable, aruniima . chakrabar |
Re: [xsl] xsl/xslt coding standard, Mike Brown | Date | Re: [xsl] Re: xpath based on condit, Mike Brown |
Month |