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

Re: How to retrieve value(which is copied into RTF as

Subject: Re: How to retrieve value(which is copied into RTF as a variable) from RTF
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 4 Jan 2005 13:41:34 GMT
parentval
   I have a RTF with following declaration
   <xsl:variable name="professionLevel"> 
       <xsl:for-each select="//profession">
         <xsl:variable name="nameval" select="@name"/>
         <xsl:variable name="parentval" select="@parent"/>
         <xsl:for-each
                            select="exslt:node-set($leverreference)/*">
           <xsl:variable name="referid" select="@levelref"/>
           <xsl:if test="$referid=$parentval">
             <xsl:copy>
               <xsl:copy-of select="$nameval"/>
             </xsl:copy>
           </xsl:if>
         </xsl:for-each>
       </xsl:for-each>
   </xsl:variable>
   

That looks a very strange definition. The select expression on your
inner fo-each doesn't depend on the current node so you will iterate
over all of $leverreference)/* repeatedly, as many times as you have 
profession elements in your original source, is that really what you
want?

The above is euivalent to

   <xsl:variable name="professionLevel"> 
       <xsl:for-each select="//profession">
         <xsl:variable name="nameval" select="@name"/>
         <xsl:variable name="parentval" select="@parent"/>
         <xsl:for-each
                            select="exslt:node-set($leverreference)/*[@levelref=$parentval]">
             <xsl:copy>
               <xsl:copy-of select="$nameval"/>
             </xsl:copy>
         </xsl:for-each>
       </xsl:for-each>
   </xsl:variable>
   

Note that although the variable is called nameval it does not store an
attribute value, but the attribute node so
    <xsl:copy>
               <xsl:copy-of select="$nameval"/>
    </xsl:copy>

generates an empty element )with name the same as the element in
$leverreference) with a name attribute.

So

<xsl:for-each
select="exslt:node-set($professionLevel)/*">
		<xsl:value-of select="."/>
	</xsl:for-each> 

will select a set of empty elements, <xsl:value-of select="."/> on each
of them will be the empty string.

You need to use <xsl:value-of select="@name"/> here in order to get any
output, but that will just concatemate all the values, so probably you
will need to add spaces or commas in between.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.