Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] How to retrieve value(which is copied into RTF as a variable) from RTF

From: "Ranjan K. Baisak" <ranjanbaisak@--------->
To:
Date: 1/4/2005 1:54:00 PM
David,
     you are right. It has a performance impact which
I can see. As I hardly work on XSLT so never get any
chance to look into performance. 
To clarify, $leverreference contains "id" values and
profession contains id and name values. I need to
retrieve names from profession depending upon id
values in $leverreference RTF and display only unique
names with number of occurrence. I would appreciate
for any suggestion on performance.

regards.
Ranjan
I have atleast used 3 RTF to get the result. 
--- David Carlisle <davidc@xxxxxxxxx> wrote:

> 
> 
>    
>    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
>
________________________________________________________________________
> 
> 



		
__________________________________ 
Do you Yahoo!? 
Send a seasonal email greeting and help others. Do good. 
http://celebrity.mail.yahoo.com


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent