[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] document function cached?


Subject: Re: [xsl] document function cached?
From: Michel Hendriksen <michel.hendriksen@xxxxx>
Date: Thu, 7 Feb 2013 18:17:41 +0100

Ok, some weird results,

<xsl:message><xsl:copy-of select="$file-nbn-set"/></xsl:message>
<xsl:message><xsl:value-of
select="$file-nbn-set/nbn-set/nbn[position()]"/></xsl:message>
<xsl:message><xsl:copy-of
select="$file-nbn-set/nbn-set/nbn[position()]"/></xsl:message>

gives me

<nbn-set><nbn>1360256741376</nbn><nbn>1360256741377</nbn><nbn>1360256741378</nbn></nbn-set>
1360256741376 1360256741377 1360256741378
<nbn>1360256741376</nbn><nbn>1360256741377</nbn><nbn>1360256741378</nbn>

So first is good as it shows the structure
2 and 3 are not what I want. I guess it just selects multiple NBN's as
position() will evaluate to true?. It does work however when putting
in a number like 2 for position()

Also

<xsl:message><xsl:copy-of
select="$file-nbn-set/nbn-set/nbn[$index]"/></xsl:message>
<nbn><xsl:value-of select="$file-nbn-set/nbn-set/nbn[$index]"/></nbn>

Works ok

How come I cant use position() as index directly?

Michel

On Thu, Feb 7, 2013 at 5:49 PM, Michel Hendriksen
<michel.hendriksen@xxxxx> wrote:
> Ok thnx! Makes sense, but not always what you might want...
>
> I will pick up a bunch of them in one go then.
>
> On Thu, Feb 7, 2013 at 5:46 PM, Liam R E Quin <liam@xxxxxx> wrote:
>> On Thu, 2013-02-07 at 17:34 +0100, Michel Hendriksen wrote:
>>
>>> So I wonder, is this call cached?
>> Yes.
>>
>>>  And if so, how can I disable caching
>>> on this call?
>>
>> You can't...
>>
>> But you can sometimes add an extra URI parameter, e.g. appending
>> ?n=1
>> ?n=2
>> ?n=3
>> and so on, to make the URI change each time.
>>
>> XSLT is a declarative language, so calling the same function with the
>> same arguments should always give the same result... although external
>> functions don't always follow that rule.
>>
>> Liam
>>
>> --
>> Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
>> Pictures from old books: http://fromoldbooks.org/
>> Ankh: irc.sorcery.net irc.gnome.org freenode/#xml


Current Thread
Keywords