[
Lists Home |
Date Index |
Thread Index
]
Hi Jonathan,
>>I was thinking of something much more simple -- a simple parameter
>>marker (?) that allows you to pass in values a la SQL:
>>
>> FOR $book IN document("catalog.xml")//book
>> WHERE $book/author = ?
>> RETURN $book
>
> How is this different from a variable?
>
> define function book-by-author(element author $a)
> {
> for $book in document("catalog.xml")//book
> where $book/author = $a
> return $book
> }
So when you perform a query, do you tell the XQuery processor to
evaluate a particular function with particular arguments, and give you
the result? I'd really like to learn more about how XQuery processors
get invoked.
As you probably know, in XSLT 1.0 you declare global parameters and
pass in values for those, along with the node that you want processed,
and it finds the template and uses the global parameters. The latest
XSLT 2.0 WD changes this model -- now you can also invoke a stylesheet
by passing in a sequence of nodes and the name of a template, and that
template gets called. Which is an interesting move. I guess that it
will mean that:
<xsl:template match="/" name="main">
<wrapper>
<xsl:apply-templates select="input()" mode="mymode" />
</wrapper>
</xsl:template>
will become a common pattern.
> What is still missing from the spec is a way to define and load
> modules. That's important functionality, IMHO.
Yes, I'd agree with that. It's certainly important in XSLT in any
case, and I think it will become more so as function libraries become
more important.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
|