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

RE: variable as select for template

Subject: RE: variable as select for template
From: Dmitri Ilyin <dmitri.ilyin@xxxxxxxxx>
Date: Wed, 19 Sep 2001 18:36:07 +0200
as select

> -----Original Message-----
> From: Jörg Heinicke [mailto:Joerg.Heinicke@xxxxxx]
> Sent: Wednesday, September 19, 2001 5:42 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE:  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
> 
> A solution would be <xsl:copy-of 
> select="component[condition]"/> instead of
> you <xsl:value-of select=""/>.
> 
Hmmm. Have I understood you right???
I've tried to put instead of <xsl:value-of...> <xsl:copy-of ...> in
<xsl:variable>
as next:
<xsl:variable name="parent_comp">  
  <xsl:choose>
   <xsl:when test="$comp_id=''">   
     <xsl:copy-of select="component[@class=$comp_class and not(@id)]"/>
   </xsl:when>
   <xsl:otherwise>
     <xsl:copy-of select="component[@class=$comp_class and @id=$comp_id]"/>
   </xsl:otherwise>
 </xsl:choose>
</xsl:variable>
the call <xsl:apply-templates select="$parent_comp">
brings me:
XSLT Error (javax.xml.transform.TransformerException): Can not convert
#RTREEFRAG to a NodeList!
It seems to me the only solutions is to use nodeset() function. But I don't
want to do it because 
i'd like my stylesheet stays "cross processor".

> Problem: You have now stored a ResultTreeFragment in your 
> variable. For
> changing the RTF into a nodeset you need an extension like 
> msxsl:node-set() or
> xalan:nodeset().
> 
> Joerg
> 
> -- 
> GMX - Die Kommunikationsplattform im Internet.
> http://www.gmx.net
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 

 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.