<font size=2 face="sans-serif">Hi,</font>
<br>
<br><font size=2 face="sans-serif">I lately implemented custom saxon instructions
that allow to create a message boxes or option dialogs from within an XSLT
script.</font>
<br>
<br><font size=2 face="sans-serif">Since it turned out to be pretty easy
to implement and very useful within my framework, I just wanted to share
this idea - and the joy over oxygen, that even this is possible.</font>
<br>
<br>
<br><font size=2 face="sans-serif">One use-cases would be a transformation
that potentially overwrites an existing file and asks the user before doing
so (if the file already exists). The code looks like this:</font>
<br><font size=2> <br>
</font><tt><font size=2> </font></tt><tt><font size=2 color=#0060a0><xsl:if</font></tt><tt><font size=2 color=#ff8141>
test=</font></tt><tt><font size=2 color=#a13f00>"java:fileExists($myFile)"</font></tt><tt><font size=2 color=#0000a1>></font></tt><tt><font size=2><br>
</font></tt><tt><font size=2 color=#0060a0><xsl:variable</font></tt><tt><font size=2 color=#ff8141>
name=</font></tt><tt><font size=2 color=#a13f00>"userDecision"</font></tt><tt><font size=2 color=#ff8141>
as=</font></tt><tt><font size=2 color=#a13f00>"xs:integer"</font></tt><tt><font size=2 color=#0000a1>></font></tt><tt><font size=2><br>
</font></tt><tt><font size=2 color=#0000a1><gui:option-dialog</font></tt><tt><font size=2 color=#ff8141>
title=</font></tt><tt><font size=2 color=#a13f00>"Warning"</font></tt><tt><font size=2 color=#ff8141>
options=</font></tt><tt><font size=2 color=#a13f00>"('Continue', 'Abort')"</font></tt><tt><font size=2 color=#ff8141>
default=</font></tt><tt><font size=2 color=#a13f00>"1"</font></tt><tt><font size=2 color=#0000a1>></font></tt><tt><font size=2><br>
</font></tt><tt><font size=2 color=#0060a0><xsl:text/></font></tt><tt><font size=2>The
file '</font></tt><tt><font size=2 color=#0060a0><xsl:value-of</font></tt><tt><font size=2 color=#ff8141>
select=</font></tt><tt><font size=2 color=#a13f00>"$myFile"</font></tt><tt><font size=2 color=#0000a1>/></font></tt><tt><font size=2>'
already exists and will be overwritten.</font></tt><tt><font size=2 color=#0060a0><xsl:text/></font></tt><tt><font size=2><br>
</font></tt><tt><font size=2 color=#0000a1></gui:option-dialog></font></tt><tt><font size=2><br>
</font></tt><tt><font size=2 color=#0060a0></xsl:variable></font></tt><tt><font size=2><br>
</font></tt><tt><font size=2 color=#0060a0><xsl:if</font></tt><tt><font size=2 color=#ff8141>
test=</font></tt><tt><font size=2 color=#a13f00>"$userDecision = 1"</font></tt><tt><font size=2 color=#0000a1>></font></tt><tt><font size=2><br>
</font></tt><tt><font size=2 color=#0060a0><xsl:message</font></tt><tt><font size=2 color=#ff8141>
terminate=</font></tt><tt><font size=2 color=#a13f00>"yes"</font></tt><tt><font size=2 color=#0000a1>></font></tt><tt><font size=2>Abort
on user request</font></tt><tt><font size=2 color=#0060a0></xsl:message></font></tt><tt><font size=2><br>
</font></tt><tt><font size=2 color=#0060a0></xsl:if></font></tt><tt><font size=2><br>
</font></tt><tt><font size=2 color=#0060a0></xsl:if></font></tt>
<br>
<br><font size=2 face="sans-serif">To implement such extension instructions
you will have to implement your own java library and put it into oxygens
lib folder.</font>
<br><font size=2 face="sans-serif">To do so follow the saxon documentation
at </font>
<br><font size=2 face="sans-serif"> </font><a href=http://www.saxonica.com/documentation/#!extensibility/instructions><font size=2 face="sans-serif">http://www.saxonica.com/documentation/#!extensibility/instructions</font></a>
<br><font size=2 face="sans-serif">and - much more important - look at
the sample of Saxon-SQL, which is included in the open source edition of
saxon: </font>
<br><font size=2 face="sans-serif"> </font><a href="http://sourceforge.net/projects/saxon/files/Saxon-HE/"><font size=2 face="sans-serif">http://sourceforge.net/projects/saxon/files/Saxon-HE/</font></a><font size=2 face="sans-serif">)</font>
<br><font size=2 face="sans-serif">Make sure to use the same version as
included into oxygen!</font>
<br>
<br>
<br><font size=2 face="sans-serif">To open the actual dialog you can use
something like</font>
<br>
<br><font size=2 face="Courier New"> JOptionPane.<i>showOptionDialog</i>(</font>
<br><font size=2 face="Courier New">
(Frame)PluginWorkspaceProvider.<i>getPluginWorkspace</i>().getParentFrame(),</font>
<br><font size=2 face="Courier New">
</font><font size=2 color=#622152 face="Courier New">textString</font><font size=2 face="Courier New">,</font>
<br><font size=2 face="Courier New">
<u>titleString</u>,</font>
<br><font size=2 face="Courier New">
(</font><font size=2 color=#622152 face="Courier New">optionList</font><font size=2 face="Courier New">.size()
== 2) ? JOptionPane.</font><font size=2 color=#0021bf face="Courier New"><b><i>YES_NO_OPTION</i></b></font><font size=2 face="Courier New">
: JOptionPane.</font><font size=2 color=#0021bf face="Courier New"><b><i>YES_NO_CANCEL_OPTION</i></b></font><font size=2 face="Courier New">,</font>
<br><font size=2 face="Courier New">
JOptionPane.</font><font size=2 color=#0021bf face="Courier New"><b><i>PLAIN_MESSAGE</i></b></font><font size=2 face="Courier New">,</font>
<br><font size=2 face="Courier New">
</font><font size=2 color=#820040 face="Courier New"><b>null</b></font><font size=2 face="Courier New">,</font>
<br><font size=2 face="Courier New">
</font><font size=2 color=#622152 face="Courier New">optionList</font><font size=2 face="Courier New">.toArray(</font><font size=2 color=#820040 face="Courier New"><b>new</b></font><font size=2 face="Courier New">
String[</font><font size=2 color=#622152 face="Courier New">optionList</font><font size=2 face="Courier New">.size()]),</font>
<br><font size=2 face="Courier New">
</font><font size=2 color=#622152 face="Courier New">defaultOption</font><font size=2 face="Courier New">);</font>
<br>
<br>
<br><font size=2 face="sans-serif">(If someone should be interested - I
will also gladly share my java code.)</font>
<br>
<br><font size=2 face="sans-serif">There is also an entry in the forum
for this:</font>
<br><font size=2 face="sans-serif"> </font><a href=http://www.oxygenxml.com/forum/topic11531.html><font size=2 face="sans-serif">http://www.oxygenxml.com/forum/topic11531.html</font></a>
<br>
<br>
<br><font size=2 face="sans-serif">Regards,</font>
<br>
<br><font size=2 face="sans-serif">Patrik</font><p></p><p><strong>GDV Dienstleistungs-GmbH & Co. KG</strong><br><span style="line-height: 1.22;">Glockengießerwall 1<br></span><span style="line-height: 1.22;">D-20095 Hamburg<br></span><span style="line-height: 1.22;">www.gdv-dl.de</span></p><p><span style="line-height: 1.22;">Sitz und Registergericht: Hamburg<br></span><span style="line-height: 1.22;">HRA 93 894<br></span><span style="line-height: 1.22;">USt.-IdNr : DE 205183123</span></p><p><span style="line-height: 1.22;">Komplementärin:<br></span><span style="line-height: 1.22;">GDV Beteiligungsgesellschaft mbH<br></span><span style="line-height: 1.22;">Sitz und Registergericht: Hamburg<br></span><span style="line-height: 1.22;">HRB 71 153</span></p><p><span style="line-height: 1.22;">Geschäftsführer:<br></span><span style="line-height: 1.22;">Dr. Jens Bartenwerfer<br>Michael Bathke<br>Heiko Beermann<br>Volker Sonnenburg</span><span style="line-height: 1.22;"></span></p><p><span style="line-height: 1.22;">------------------------------------------------------------------<br></span><span style="line-height: 1.22;">Diese E-Mail und alle Anhänge enthalten vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe der E-Mail ist nicht gestattet.</span></p><p><span style="line-height: 1.22;">This e-mail and any attached files may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distributionof the material in this e-mail is strictly forbidden.</span></p><p></p>