"John L. Clark" wrote: > On 1/5/07, Hussein Shafie <hussein at xmlmind.com> wrote: >> > It would be nice to know if you intend to implement a "transform" >> command, >> >> We could implement it in next version if there is sufficient interest. > > I am also definitely interested in such a command.
OK. > >> Using the XSLT style sheet passed as a parameter, the "transform" >> command transforms part or all of the document being edited (explicit >> selection, implicit selection, whole document, depending on a >> parameter) to an output stream (XML, HTML, plain text). > > Would there be a mechanism for the XSLT script to identify the > selected nodes within their parent (as the <copyDocument/> process > command element allows)? Yes. > In order to apply multiple XSLT scripts in sequence to a given > selection, would you basically have to paste in the results of the > first script, select those results, and then apply a second transform > command? Yes. Here are the specifications of such command: --- Like a number of other commands, the "transform" command is only useful for writing macros. Using the XSLT style sheet passed as a parameter, the "transform" command transforms part or all of the document being edited (explicit selection, implicit selection, whole document, depending on a parameter) to an output stream (XML, HTML, plain text). This output stream is ``loaded as a string'' and returned as the result of the "transform" command. If this result is the string representation of an XML tree, it could be directly used by a subsequent "paste" command. If this result is a plain text list of items, it could be directly used by a subsequent "pick" command. The parameters of the "transform" command are: * The URL of the XSLT style sheet. (The "%c" variable will be made available in order to resolve URLs relative to the configuration containing the macro invoking the transform command.) * Optional parameters for this XSLT style sheet. * What is to be transformed (explicit selection, implicit selection, whole document; default: explicit selection). * The encoding of the output stream (default: UTF-8). The "transform" command should be much more efficient than a process command, even when the XSLT style sheet of the process command is cached and when there is no user feedback during the execution of the process command. --- Note that: [1] The "transform" command is not a replacement for process commands. [2] The "transform" command has no extra features compared to process commands. The "transform" command is more or less equivalent to this process command: <copyDocument/> <transform/> <read/> Except that the ``<copyDocument/> step'' does not copy any document but instead *SAX* *traverses* part or all of the document being edited.

