Re: XPath version

On 11/9/07, Jeni Tennison <jeni@jenitennison.com> wrote:
>
> Bearing in mind that all options are strings:
>
> <p:xslt>
>    <p:input name="source" select="/database/record[position() = $index]">
>      <p:pipe step="pipe" port="source" />
>    </p:input>
>    ...
> </p:xslt>
>
> Of course you could say that options were xs:untypedAtomic instead; at
> least that would make them castable. Then the only problem would come if
> you actively created a string using something like:
>
> <p:xslt>
>    ...
>    <p:param name="monthName"
>      select="/months/month[position() = substring($date, 6, 2)]">
>      <p:document href="months.xml" />
>    </p:param>
>    ...
> </p:xslt>

Wrapping the right-hand side in a number() function call would fix
this for XPath 2.0
while keeping XPath 1.0 compatible.

-- 
--Alex Milowski
"The excellence of grammar as a guide is proportional to the paucity of the
inflexions, i.e. to the degree of analysis effected by the language
considered."

Bertrand Russell in a footnote of Principles of Mathematics

Received on Monday, 12 November 2007 18:08:35 UTC