RE: [xsl] variable as select for template

Subject: RE: [xsl] variable as select for template
From: Dmitri Ilyin <dmitri.ilyin@xxxxxxxxx>
Date: Wed, 19 Sep 2001 17:11:07 +0200

> -----Original Message-----
> From: Michael Kay [mailto:mhkay@xxxxxxxxxxxx]
> Sent: Wednesday, September 19, 2001 5:04 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] variable as select for template
> 
> 
> > I'd like to make it with <xsl:value-of...> or something else
> > because i have
> > to decide on the fly which node set i need. My thought was
> > may be i can use
> > document() function here???
> 
> I think you need to explain what you're trying to achieve. 
> Your solution
> isn't going to work, because xsl:value-of produces text as 
> its result, not a
> node-set.
> 
> Mike Kay
That was my try (it's a fragment):

<xsl:variable name="parent_comp">  <!-- I wanted to get a node set in
variable -->
  <xsl:choose>
   <xsl:when test="$comp_id=''">   <!-- the node set depends on a condition
-->
     <xsl:value-of select="component[@class=$comp_class and not(@id)]"/>
   </xsl:when>
   <xsl:otherwise>
     <xsl:value-of select="component[@class=$comp_class and @id=$comp_id]"/>
   </xsl:otherwise>
  </xsl:choose>
</xsl:variable>

then i could use variable $parent_comp just as node set here and in other
places in stylesheet:
<xsl:apply-templates mode="extract_property" select="$parent_comp">

If <xsl:value-of select"..."/> always get text() as result, are there any
solutions???

thanks for advise

Dmitri

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


Current Thread