Custom Tools

Are you missing a feature? Request it's implementation here.
Posts: 14
Joined: Fri Jan 09, 2004 11:26 pm

Custom Tools

Post by adsmart » Wed Mar 17, 2004 2:47 am

I think I need to explain something I threw out there a little eariler a bit better.

I almost exclusively use Oxygen for developing XSL templates. I use a lot of Modes in my transforms. Like anyone whose written more than a half dozen templates, most of my apply-templates tags look like:

Code: Select all

<xsl:apply-templates mode="thismode" />
This means that I always have:

Code: Select all

<xsl:template match="*" mode="thismode" priority="-10" />
Becuase this also results in a lot of whitespace making its way into the output I also usually have:

Code: Select all

<xsl:template match="text" mode="thismode" priority="1" >
<xsl:value-of select="normalize-space(.) />
As it turns out, I write this a lot. I have as many at 10 modes in an smallish transform and I usually spend a fair bit of time checking for all my modes and adding the necessary templates.

To get around this, I've written a transform that looks at a xslt file, copies it back to the output adding my default and text templates for all those modes that I haven't done it for.

What would be nice is to be able to take that transform and use it as a tool (like the pretty print) for XSLT editing. Obviously instead of putting the results in a result tab, I want it to go into the (current) input window.

I would make the currently edited document the input document and I would add a parameter (always named "currentselection" or some such) that would be the nodeset of the current selection or cursor position. You wouldn't want a copy of the current selection, you'd want the actual nodeset so you can work with the input document in correct location.

For instance you'd want to be able to do:

Code: Select all

 <xsl:apply-templates select="$currentselection/ancestor-or-self::xsl:template" />
In addition, I would like to be able to setup the custom tools to take in parameters that would be retrieved from a dialog box. I would support, straight text (perhaps with a regular expression), select from a list (which may be fixed or come from some XML file), html markup in the dialog.

Most of the editing features I want, I'm the only one who is going to want them. Many people are going to be the same way. Each of us uses oxygen for different reasons. In many cases, one can write a transform to do what we want (although sometimes they become pretty tortured and its easier to make the change by hand).

Adding the ability for each of us to, if we choose, customize our own editor tools in this ways would be very powerful. Provide a way to bundle these customizations together and you'll probably find a good chunk of the community contributing tools.