Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Change xpath depending on whether a param has been set >Thread Next - Re: Change xpath depending on whether a param has been set Re: Change xpath depending on whether a param has been setTo: 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() <= $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() < >> $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() < > $maxNodes][$maxNodes != -1] > | > > /RESULTS/REVIEWS/REVIEW[$maxNodes = -1] > " > >> > > <!-- Do whatever processing is required --> > > </xsl:for-each> > > > Cheers, > Dimitre Novatchev > > | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
