|
Subject: Re: Need help for the query example From: Brandon Ibach <bibach@xxxxxxxxxxxxxx> Date: Tue, 20 Jul 1999 20:27:56 -0500 |
Quoting Didier PH Martin <martind@xxxxxxxxxxxxx>:
> thank for the reference Matthias, I forgot this was available. But I still
> have problems with the query-expression. Let say I want to see if the
> current node is a processing instruction and more particularly to associate
> action to processing instructions like this:
> <?xml version="1.0"?>
> <?xml-stylesheet type="text/dsssl" href="../myscript.dsl"
> media="screen,pdf"?>
>
> Then, if I have a query-expression like this:
>
> (query (node-property "systemData" (current-node))
> do something....
> )
>
> Then, I can match based on the property SystemData that all PIs have.
> However, the current-node is set in that case to current-root, thus, it wont
> be the current node.
>
Right... if you want this rule to match *every* PI in the entire
document, then (assuming that only PI's have systemData) something
like the following should work:
(query (node-list-filter
(lambda (n) (node-property "systemData" n default: #f))
(descendants (current-root)))
(construction-rule-here))
If you wanted to do further checking on the value of systemData,
you could replace the (node-property) call in the lambda expression
above with something more elaborate, as long as it returns anything
but #f for the nodes you want the rule to match.
Unless Jade (or whatever processor would be doing this) is quite
clever, this would be a fairly inefficient process, of course, as it
forces the engine to go through every node in the grove, checking for
that property. I'm not sure, offhand, if there is a better way to do
this, but this should work, at least.
-Brandon :)
DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: Need help for the query example, Didier PH Martin | Thread | RE: Need help for the query example, Didier PH Martin |
| RE: Need help for the query example, Didier PH Martin | Date | RE: Need help for the query example, Didier PH Martin |
| Month |