Hi Hussein,

Many, many thanks for your answers and examples - the more one realizes whats 
possible with xxe the more fun it is to use - ahem, customize.

Cheers

stephan

-----Urspr?ngliche Nachricht-----
Von: Hussein Shafie [mailto:hussein at pixware.fr] 
Gesendet: Freitag, 29. Oktober 2004 13:31
An: Marsoner Stephan
Cc: xmleditor-support at xmlmind.com
Betreff: [Maybe Spam] Re: [XXE] filling dialogs/comboboxes with data values

Marsoner Stephan wrote:
> I tried to write a macro which should fill a dialog box with values of
> elements of the same name like the implicit selected element but failed
> miserably! 
> 
> 
>     <cfg:command name="pick-this">
>         <cfg:macro>
>             <cfg:sequence>
>                 <cfg:get
> context="//*[local-name(.)=local-name($implicitElement)]
> expression="."/>
>                 <cfg:command name="pick" parameter="Choose false %_"/>
>                 <cfg:command name="alert" parameter="%_"/> 
>             </cfg:sequence>    
>         </cfg:macro>      
>     </cfg:command>
> 
> Other promising get-constructs, which didn't work either:
> 
> <cfg:get context="//$implicitNode"  expression="."/>
> 
> <cfg:get context="//$implicitElement"  expression="*"/>
> 
> <cfg:get context="//{$implicitElement}"  expression="."/>
> 
> ...
> 
> Is it possible at all?

I have tested this with the XHTML document below:

---
     <cfg:command name="pick-this">
         <cfg:macro>
             <cfg:sequence>
                 <cfg:get expression="//li"/>
                 <cfg:command name="pick" parameter="Choose false %_"/>
                 <cfg:command name="alert" parameter="%_"/>
             </cfg:sequence>
         </cfg:macro>
     </cfg:command>

   <binding>
     <keyPressed code="F5" />
     <command name="pick-this" />
   </binding>
---

(Specify expression such as "//foo" in the expression attribute, not in 
the context attribute. The default context is the document, which is 
fine for absolute expressions.)

---
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html>
   <head>
     <title>xxxx</title>
   </head>

   <body>
     <p>xxxx</p>

     <p>yyy</p>

     <p>xxxx</p>

     <ul>
       <li>A</li>

       <li>B</li>

       <li>C</li>
     </ul>

     <p>The end.</p>
   </body>
</html>
---

It works as expected. It displays a list containing just A (and not A, B 
and C).

Explanation:
* //li returns a node-set.
* a node-set is converted to a string by returning the string value of 
the node of the node-set which is first in document order.

To make this work, you need to use a ``join function'': join(//li, ' ').
Unfortunately, there is no standard join function in XPath, so you need 
to write it yourself in Java.

An alternative is to use a process command (cached, with no feedback) as 
the first item of your macro-command. See 
http://www.xmlmind.com/xmleditor/_distrib/docs/commands/ch05.html
This process command will write a text file containing quoted string 
which will be loaded using a <read> process command item.



> Similarily, is it possible to add a css-rule for an element with a
> combo-box filled with unique values which are already used for this
> element, somehow with xpath/label ???
> 
> Example:
> 
> <test>
>       <x>a</x>
>       <x>d</x>
>       <x>b</x>
>       <x>b</x>
> </test>
> 
> In element x I would like to have a combo-box with [a b d] as values.

Yes, this should be possible because you can use XPath expressions to 
parameterize the combo-box but, here too, a ``join function'' is needed.

---
PS: With XXE, almost everything is possible if you write it in Java.




**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


Reply via email to