Using custom functions defined in an external xsl file in ox

Post here questions and problems related to oXygen frameworks/document types.
DirkDubois
Posts: 22

Using custom functions defined in an external xsl file in ox

Fri Oct 24, 2014 6:09 pm

Hello,

Does anyone know of a way to call functions defined in an external xsl style sheet from the oxy_xpath() function provided to populate content in a CSS file?

I am implementing some form controls whose values are populated by an xpath expression. The often the xpath expressions are very complicated and have dependencies on other xml files or are attempting to do conditional matches across the current document.

The problem is as follows:
XML Source:

Code: Select all

<root>
   <group>
      <ID>myID</ID>
      <item>(content to be populated by xpath)</item>
   </group>
<definitions>
   <define>
      <ID>myID</ID>
      <list>value 1</list>
   </define>
   <define>
      <ID>myOtherID</ID>
      <list>value 2</list>
   </define>
</definitions>
</root>

CSS File:

Code: Select all

item{
   content:oxy_xpath("util:getItemContent(../ID)");
}


I am open to a complete solution implemented in place in xpath, but at the moment I have not been able to get this working. Thank you for all your help.

Sincerely,
Dirk Dubois
XML Programmer, Technical Writing
Matrox Imaging
alex_jitianu
Posts: 632

Re: Using custom functions defined in an external xsl file i

Tue Oct 28, 2014 9:39 am

Hello Dirk,

Unfortunately I can't think of a way to do that... Just to make things clearer, you want this because the XPath language in itself imposes limitations or just because it is convoluted to express some complex things?

What you can currently do is to move this code from the CSS to a StylesFilter (which is a java extension). From a Styles filter you can use our Java based API to execute an [url=https://www.oxygenxml.com/InstData/Editor/Plugins/javadoc/ro/sync/exml/workspace/api/util/XMLUtilAccess.html#createXSLTTransformer(javax.xml.transform.Source,%20java.net.URL[],%20int)]XSLT transformation[/url].

Best regards,
Alex
DirkDubois
Posts: 22

Re: Using custom functions defined in an external xsl file i

Tue Oct 28, 2014 3:26 pm

Hello Alex,

Thank you for the quick reply. I assumed I would have to move to a java based extension to develop some of the more complex selection functionality that we want to implement in the author view. Currently we do not develop in java as our language of choice is C#. Do you happen to know of a way to develop in C# and port to Java for oxygens extensions? Or must I use Java? Thank you for all your help.

Thanks,
Dirk
XML Programmer, Technical Writing
Matrox Imaging
alex_jitianu
Posts: 632

Re: Using custom functions defined in an external xsl file i

Tue Oct 28, 2014 4:19 pm

Hello Dirk,

I don't have much knowledge of such conversions from C# to Java. Searching on-line does produce some tools that do that but I can't really envision how that would work. Our API is Java based and in the code you write you have to use this API, is not like you just write a generic C# code (with no dependencies of external libraries) that will then be converted...

Best regards,
Alex
DirkDubois
Posts: 22

Re: Using custom functions defined in an external xsl file i

Tue Oct 28, 2014 4:35 pm

Hello Alex,

I figured as much. Well not a problem we will simply develop a plugin in Java (the language is very similar to C# anyway). Do you have a particular toolchain or IDE to recommend when developing plugins for oxygen?

Thanks,
Dirk
XML Programmer, Technical Writing
Matrox Imaging
alex_jitianu
Posts: 632

Re: Using custom functions defined in an external xsl file i

Wed Oct 29, 2014 9:48 am

Hello Dirk,

Well, all of us are using Eclipse and we have a number of topics in our documentation that describe how to use Eclipse for various tasks. Starting with version 16.0 the SDK we have a Maven repository for the SDK and we found an Eclipse IDE for Java EE Developers very helpful when working with Maven projects. You can read some more about the StylesFilter I've talked about in topic Configuring CSS Styles Filter.

Best regards,
Alex
DirkDubois
Posts: 22

Re: Using custom functions defined in an external xsl file i

Wed Oct 29, 2014 3:27 pm

Hello Alex,

Thank you for all the great support! I will investigate these technologies and tools.

All the best,

Dirk
XML Programmer, Technical Writing
Matrox Imaging

Return to “SDK-API, Frameworks - Document Types”

Who is online

Users browsing this forum: No registered users and 1 guest