First of all, we already have a join() XPath function. See
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/ch07s01.html

Alain Pierrot wrote:
> I am trying to build an user-friendly way of populating IDREFS 
> attributes which would:
> 1) select through an XPath function the relevant targets (subset of  ids
> to avoid scrolling the full list);
> 2) display in a pop-up relevant information to allow the choice, i.e. 
> (calculated) content of elements rather than ids;
> 3) allow multiple selection.
> 
> "set-attribute-button" (http://www.xmlmind.com/xmleditor/_distrib/doc/
> csssupport/ch05s29.html) is restricted to the whole list of ids and 
> doesn't allow multiple selection (which makes it awkward to use with 
> IDREFS)
> ? Is there a workaround there ?
> ? Could multiple selection ability for set-attribute-button be added  to
> the wish-list ?

This could be implemented using a command-button
http://www.xmlmind.com/xmleditor/_distrib/doc/csssupport/ch05s06.html
invoking a macro-command.

The macro-command would:
[1] Collect IDs using XPath-based "get" construct.
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/ch04.html

[2] Use command "pick" to let the user select IDs.
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/ch06s40.html

[3] set the IDREFS attribute using command "putAttribute".
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/ch06s42.html

The only problen is that command "pick" does not support multiple
selections. You'll need to write an enhanced command "pick" yourself.
This is trivial (the source code of command "pick" is attached).



> "list" (http://www.xmlmind.com/xmleditor/_distrib/doc/csssupport/
> ch05s24.html) seems the best way to achieve what I wish but I can't 
> find a way to build labels and values with the actual coverage of  XPath
> 1.0.
> ? Any idea to convert a node set into the \A separated strings "list" 
> manages ?

I've tested something like this and it works fine:

---
foo {
    content: list(attribute, bar,
                  values, xpath("join(//@id, '\A ')"),
                  selection, multiple,
                  separator, " ");
}
---

The only problem is: how do you refresh the content of the list as the
author adds more IDs to the document?

The above approach, command-button+macro-command, is much better IMHO.




> XPath 2.0 seems to offer a whole lot of facilities to enhance the 
> already very convenient support XXE provides (the "if" feature is 
> really an useful extension:-)).
> ? Do you consider covering more features of XPath 2.0 in future  releases?
> function "for $x in" would be useful together with "string- join"
> (http://www.w3.org/TR/xquery-operators/#func-string-join)...

We'll probably add more XPath extension functions in the future. These
extension functions will be as close to their XPath 2.0 counterpart as
possible.

We do not intend to support full XPath 2.0 in the near future. XPath 1.0
 seems to be sufficient for 99% of our needs.

---
PS: To my knowledge, "for $x in" is XQuery, not XPath 2.0.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Pick.java
Type: text/x-java
Size: 5217 bytes
Desc: not available
Url : 
http://www.xmlmind.com/pipermail/xmleditor-support/attachments/20050905/490c342d/attachment.java
 

Reply via email to