![]() |
Embedded scripts |
Post Reply
|
| Author | ||
falik
Newbie
Joined: 13 Oct 2011 Posts: 10 |
Post Options
Quote Reply
Topic: Embedded scriptsPosted: 19 Oct 2011 at 10:22am |
|
|
Hi ! I have to call an external function in my xslt/xsl-fo stylesheet. I know that I can use <xsl:script> according to the recommendation (http://www.w3.org/TR/xslt11/#define-extension-functions) The question is how to actually use it ? I'm using formatter to transform my stylesheets and I have to add an external function written in a different language than xslt, preferably C++ or C#. Is that possible ? I mean I don't really understand the way that it works. Actually will it work just fine if I use a java code inside the <script> tags ? I don't understand how the code is interpreted or compiled. Can anyone lighten it up a but for me ? In the specification it's stated that my processor must support the language of the script. I'm supposed to use the integrated one. What languages are supported by him ? I looked through the internet and found some microsoft references(http://msdn.microsoft.com/en-us/library/533texsx(vs.71).aspx) but the problem is that I don't want to process the xml outside the formatter and If I understood that microsoft article clearly they tell me to write a program in C# that will do the transformation outside. It's not my goal 'cause I need something to be done in one step just using my formatter. thanks in advance for any tips. |
||
![]() |
||
radup
Admin Group
Adminstrator Joined: 19 May 2008 Posts: 83 |
Post Options
Quote Reply
Posted: 21 Oct 2011 at 10:57am |
|
|
You can define your own script in XF Designer using the following dialog http://www.ecrion.com/Temp/HelpCache/XFDesigner/framed_hidd_managescriptsdlg.htm
The languages supported are JavaScript, C# and VB. Note that C# it will work only with .Net parser. The code is compiled and executed at XSLT transfromation. Here an example: 1. In the home tab ( or in the review tab - depending what XF Designer version are you using), click Manage Scripts and paste the following:
When you want to use this function, go to Insert Tab and click Field. The Edit Expression dialog will come up, and you can type something like this:
Where /root/phone is the path to your data. Note: - the xsl "string" function which will force the parser to evaluate the xpath when is passed to the javascript function.
- formatPhoneNumber is now displayed under Functions in the Edit Expression dialog. Edited by radup - 21 Oct 2011 at 10:59am |
||
![]() |
||
Post Reply
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |