Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Change xpath depending on whether a param has been set

From: "Joe Gass" <joe@------.--->
To: NULL
Date: 2/4/2005 11:18:00 AM
Thanks for that idea Dimitre, I worked it out another way.  I moved my 
workings to a new template, then...

<xsl:choose>
 <xsl:when test="$maxNodes!=''">
  <xsl:apply-templates select="/RESULTS/REVIEWS/REVIEW[position() &lt;= 
$maxNodes]"/>
 </xsl:when>
 <xsl:otherwise>
  <xsl:apply-templates select="/RESULTS/REVIEWS/REVIEW"/>
 </xsl:otherwise>
</xsl:choose>

I'll give your way a go too

Many thanks


"Dimitre Novatchev" <dnovatchev@y...> wrote in message 
news:36h3mgF51mj4tU1@i......
>
> "Joe Gass" <joe@n...> wrote in message 
> news:%23TpqPaqCFHA.4004@t......
>> I'd like to optionally cap the number of returned nodes
>> If param maxNodes is sent then
>> <xsl:for-each select="/RESULTS/REVIEWS/REVIEW[position() &lt; 
>> $maxNodes]">
>>
>> Otherwise just use
>> <xsl:for-each select="/RESULTS/REVIEWS/REVIEW">
>>
>> Thanks
>
>
> Specify an unusual value for the $maxNodes parameter -- say -1.
>
> Then you'll have:
>
> <xsl:for-each select="/RESULTS/REVIEWS/REVIEW
>                                                [position() &lt; 
> $maxNodes][$maxNodes != -1]
>                                 |
>
>                                   /RESULTS/REVIEWS/REVIEW[$maxNodes = -1]
>                            "
>
>>
>
>   <!-- Do whatever processing is required -->
>
> </xsl:for-each>
>
>
> Cheers,
> Dimitre Novatchev
>
> 




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