RE: Need help for the query example

Subject: RE: Need help for the query example
From: "Didier PH Martin" <martind@xxxxxxxxxxxxx>
Date: Tue, 20 Jul 1999 21:30:46 -0400
Hi Brandon,

Many thanks Brandon, now I'll be able to finish my document.

Didier PH Martin
mailto:martind@xxxxxxxxxxxxx
http://www.netfolder.com

-----Original Message-----
From: owner-dssslist@xxxxxxxxxxxxxxxx
[mailto:owner-dssslist@xxxxxxxxxxxxxxxx]On Behalf Of Brandon Ibach
Sent: Tuesday, July 20, 1999 9:28 PM
To: dssslist@xxxxxxxxxxxxxxxx
Subject: Re: Need help for the query example


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


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread