Re: Java script with xsl in FOP ?
Abhi, Abhijit Junnare wrote: Is it possible to use javascript inside the XSL that will be used with FOP. I need to do some calculations and so I need this. Is there any other way to do some basic math or some string manipulation? I know the string functions in xsl but I am afraid they wont solve my problem. Any help if appreciated. Thanks, Abhi I've heard that XML (and/or XSLT?) has the capability to do JavaScript during processing. However, I've never needed to do this in my calculations. I've done some fairly complicated mathematical calculations using a combination of XSLT and XPath functions. In either case, this is somewhat off-topic for the FOP-user list. You should be able to find more information by searching for numeric functions in XSL or XPath. HTH! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Java script with xsl in FOP ?
Here's how we insert a dynamicly generated script it in the xslt that passes through to the HTML: script language=JavaScriptloadTopFrame(quot;xsl:value-of select=$print-csr/quot;,quot;xsl:value-of select=$print-quick-trend/quot;,quot;xsl:value-of select=$print-quick-visit-history/quot;);var protocolId = 'xsl:value-of select=@PROTOCOL_ID /';/script As you can see it could get a little ugly with large functions, but I think it should still be possible to carry anything through to the HTML. Good luck. -Matt -Original Message- From: Clay Leeds [mailto:[EMAIL PROTECTED] Sent: Friday, September 12, 2003 10:05 AM To: [EMAIL PROTECTED] Subject: Re: Java script with xsl in FOP ? Abhi, Abhijit Junnare wrote: Is it possible to use javascript inside the XSL that will be used with FOP. I need to do some calculations and so I need this. Is there any other way to do some basic math or some string manipulation? I know the string functions in xsl but I am afraid they wont solve my problem. Any help if appreciated. Thanks, Abhi I've heard that XML (and/or XSLT?) has the capability to do JavaScript during processing. However, I've never needed to do this in my calculations. I've done some fairly complicated mathematical calculations using a combination of XSLT and XPath functions. In either case, this is somewhat off-topic for the FOP-user list. You should be able to find more information by searching for numeric functions in XSL or XPath. HTH! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Java script with xsl in FOP ?
Abhijit Junnare wrote: Is it possible to use javascript inside the XSL that will be used with FOP. I need to do some calculations and so I need this. Is there any other way to do some basic math or some string manipulation? I know the string functions in xsl but I am afraid they wont solve my problem. Any help if appreciated. (This is really an XSLT question.) I haven't ever done it with javascript, but I understand that it can be done. See the bottom of: http://groups.yahoo.com/group/XSL-FO/message/3857 where a method for using java in XSLT (to get today's date) is demonstrated. Note also that this must be dependent on your XSLT engine, so check its docs or mailing lists for more specific information. Victor Mote - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Java script with xsl in FOP ?
As long as the calculations get done somewhere, either by the XLST processor or the browser, the end result should be the same correct? (Unless some other XSLT process is dependent on the outcome of these calcs.) -Original Message- From: Victor Mote [mailto:[EMAIL PROTECTED] Sent: Friday, September 12, 2003 10:11 AM To: [EMAIL PROTECTED] Subject: RE: Java script with xsl in FOP ? Abhijit Junnare wrote: Is it possible to use javascript inside the XSL that will be used with FOP. I need to do some calculations and so I need this. Is there any other way to do some basic math or some string manipulation? I know the string functions in xsl but I am afraid they wont solve my problem. Any help if appreciated. (This is really an XSLT question.) I haven't ever done it with javascript, but I understand that it can be done. See the bottom of: http://groups.yahoo.com/group/XSL-FO/message/3857 where a method for using java in XSLT (to get today's date) is demonstrated. Note also that this must be dependent on your XSLT engine, so check its docs or mailing lists for more specific information. Victor Mote - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Java script with xsl in FOP ?
I wont be using browser at all. Thats why I am wondering if it would work? Abhi --- Savino, Matt C [EMAIL PROTECTED] wrote: As long as the calculations get done somewhere, either by the XLST processor or the browser, the end result should be the same correct? (Unless some other XSLT process is dependent on the outcome of these calcs.) -Original Message- From: Victor Mote [mailto:[EMAIL PROTECTED] Sent: Friday, September 12, 2003 10:11 AM To: [EMAIL PROTECTED] Subject: RE: Java script with xsl in FOP ? Abhijit Junnare wrote: Is it possible to use javascript inside the XSL that will be used with FOP. I need to do some calculations and so I need this. Is there any other way to do some basic math or some string manipulation? I know the string functions in xsl but I am afraid they wont solve my problem. Any help if appreciated. (This is really an XSLT question.) I haven't ever done it with javascript, but I understand that it can be done. See the bottom of: http://groups.yahoo.com/group/XSL-FO/message/3857 where a method for using java in XSLT (to get today's date) is demonstrated. Note also that this must be dependent on your XSLT engine, so check its docs or mailing lists for more specific information. Victor Mote - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Java script with xsl in FOP ?
Duh, I forgot this was the FOP board. Is this output going to PDF? I think PDF can also do some form of JavaScript processing but I've never tried. -Original Message- From: Savino, Matt C Sent: Friday, September 12, 2003 10:16 AM To: [EMAIL PROTECTED] Subject: RE: Java script with xsl in FOP ? As long as the calculations get done somewhere, either by the XLST processor or the browser, the end result should be the same correct? (Unless some other XSLT process is dependent on the outcome of these calcs.) -Original Message- From: Victor Mote [mailto:[EMAIL PROTECTED] Sent: Friday, September 12, 2003 10:11 AM To: [EMAIL PROTECTED] Subject: RE: Java script with xsl in FOP ? Abhijit Junnare wrote: Is it possible to use javascript inside the XSL that will be used with FOP. I need to do some calculations and so I need this. Is there any other way to do some basic math or some string manipulation? I know the string functions in xsl but I am afraid they wont solve my problem. Any help if appreciated. (This is really an XSLT question.) I haven't ever done it with javascript, but I understand that it can be done. See the bottom of: http://groups.yahoo.com/group/XSL-FO/message/3857 where a method for using java in XSLT (to get today's date) is demonstrated. Note also that this must be dependent on your XSLT engine, so check its docs or mailing lists for more specific information. Victor Mote - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Java script with xsl in FOP ?
Abhijit Junnare wrote: Dear Clay, Thanks much. May be you could help me since you have done some calculations. Let me know if you think its feasible or not. I have some xml element called Name. I want to check the length of the Name element. If the string length for this is for example 10. I want to write it in a fixed width for example 20. So since I want the field to be fixed I want to add 10 fill charaters. The number of fill characters I want to add will vary as per the string length. Also the alignment can be different. If the alignment is center then I want to add fill characters before(here 5) and after (here 5) the actual Name. If alignment is left then I want to add fill characters (here 10)after the name and similarly for right aligned I want to add before the Name. Do you think something like this is feasible using XSL for variable lengths of the strings that come from xml? Your help is really appreciated. Thanks, Abhi Please forgive that I'm responding to the list, but I want to ensure this discussion is public in the event others may find this thread useful. This is the link to the searchable (and excellent) xsl-list archive: http://www.biglist.com/lists/xsl-list/archives/ This thread on the xsl-list has some good info: http://www.biglist.com/lists/xsl-list/archives/200011/msg00817.html In addition, this DocBook library may have some useful templates: http://docbook.sourceforge.net/release/xsl/current/doc/lib/lib.html HTH! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Java script with xsl in FOP ?
YES. The output will be pdf. So I dont want to proceed if I know that it wont work in the future. So I am asking everyone so that I can think what I should be doing. Abhi --- Savino, Matt C [EMAIL PROTECTED] wrote: Duh, I forgot this was the FOP board. Is this output going to PDF? I think PDF can also do some form of JavaScript processing but I've never tried. -Original Message- From: Savino, Matt C Sent: Friday, September 12, 2003 10:16 AM To: [EMAIL PROTECTED] Subject: RE: Java script with xsl in FOP ? As long as the calculations get done somewhere, either by the XLST processor or the browser, the end result should be the same correct? (Unless some other XSLT process is dependent on the outcome of these calcs.) -Original Message- From: Victor Mote [mailto:[EMAIL PROTECTED] Sent: Friday, September 12, 2003 10:11 AM To: [EMAIL PROTECTED] Subject: RE: Java script with xsl in FOP ? Abhijit Junnare wrote: Is it possible to use javascript inside the XSL that will be used with FOP. I need to do some calculations and so I need this. Is there any other way to do some basic math or some string manipulation? I know the string functions in xsl but I am afraid they wont solve my problem. Any help if appreciated. (This is really an XSLT question.) I haven't ever done it with javascript, but I understand that it can be done. See the bottom of: http://groups.yahoo.com/group/XSL-FO/message/3857 where a method for using java in XSLT (to get today's date) is demonstrated. Note also that this must be dependent on your XSLT engine, so check its docs or mailing lists for more specific information. Victor Mote - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Java script with xsl in FOP ?
Can you paste the entire JavaScript functionality you are trying to emulate with XSLT, or is it too much? X-PATH is tricky, but you can do a lot with it. -Original Message- From: Abhijit Junnare [mailto:[EMAIL PROTECTED] Sent: Friday, September 12, 2003 10:25 AM To: [EMAIL PROTECTED] Subject: RE: Java script with xsl in FOP ? YES. The output will be pdf. So I dont want to proceed if I know that it wont work in the future. So I am asking everyone so that I can think what I should be doing. Abhi --- Savino, Matt C [EMAIL PROTECTED] wrote: Duh, I forgot this was the FOP board. Is this output going to PDF? I think PDF can also do some form of JavaScript processing but I've never tried. -Original Message- From: Savino, Matt C Sent: Friday, September 12, 2003 10:16 AM To: [EMAIL PROTECTED] Subject: RE: Java script with xsl in FOP ? As long as the calculations get done somewhere, either by the XLST processor or the browser, the end result should be the same correct? (Unless some other XSLT process is dependent on the outcome of these calcs.) -Original Message- From: Victor Mote [mailto:[EMAIL PROTECTED] Sent: Friday, September 12, 2003 10:11 AM To: [EMAIL PROTECTED] Subject: RE: Java script with xsl in FOP ? Abhijit Junnare wrote: Is it possible to use javascript inside the XSL that will be used with FOP. I need to do some calculations and so I need this. Is there any other way to do some basic math or some string manipulation? I know the string functions in xsl but I am afraid they wont solve my problem. Any help if appreciated. (This is really an XSLT question.) I haven't ever done it with javascript, but I understand that it can be done. See the bottom of: http://groups.yahoo.com/group/XSL-FO/message/3857 where a method for using java in XSLT (to get today's date) is demonstrated. Note also that this must be dependent on your XSLT engine, so check its docs or mailing lists for more specific information. Victor Mote - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Java script with xsl in FOP ?
[EMAIL PROTECTED] wrote: Can you paste the entire JavaScript functionality you are trying to emulate with XSLT, or is it too much? X-PATH is tricky, but you can do a lot with it. Here is some functionality that I would like to emulate in XSLT. I have some xml element called Name. I want to check the length of the Name element. If the string length for this is for example 10. I want to write it in a fixed width for example 20. So since I want the field to be fixed I want to add 10 fill charaters. The number of fill characters I want to add will vary as per the string length. Also the alignment can be different. If the alignment is center then I want to add fill characters before(here 5) and after (here 5) the actual Name. If alignment is left then I want to add fill characters (here 10)after the name and similarly for right aligned I want to add before the Name. Do you think something like this is feasible using XSL for variable lengths of the strings that come from xml? Your help is really appreciated. Thanks, Abhi --- Savino, Matt C [EMAIL PROTECTED] wrote: Can you paste the entire JavaScript functionality you are trying to emulate with XSLT, or is it too much? X-PATH is tricky, but you can do a lot with it. -Original Message- From: Abhijit Junnare [mailto:[EMAIL PROTECTED] Sent: Friday, September 12, 2003 10:25 AM To: [EMAIL PROTECTED] Subject: RE: Java script with xsl in FOP ? YES. The output will be pdf. So I dont want to proceed if I know that it wont work in the future. So I am asking everyone so that I can think what I should be doing. Abhi --- Savino, Matt C [EMAIL PROTECTED] wrote: Duh, I forgot this was the FOP board. Is this output going to PDF? I think PDF can also do some form of JavaScript processing but I've never tried. -Original Message- From: Savino, Matt C Sent: Friday, September 12, 2003 10:16 AM To: [EMAIL PROTECTED] Subject: RE: Java script with xsl in FOP ? As long as the calculations get done somewhere, either by the XLST processor or the browser, the end result should be the same correct? (Unless some other XSLT process is dependent on the outcome of these calcs.) -Original Message- From: Victor Mote [mailto:[EMAIL PROTECTED] Sent: Friday, September 12, 2003 10:11 AM To: [EMAIL PROTECTED] Subject: RE: Java script with xsl in FOP ? Abhijit Junnare wrote: Is it possible to use javascript inside the XSL that will be used with FOP. I need to do some calculations and so I need this. Is there any other way to do some basic math or some string manipulation? I know the string functions in xsl but I am afraid they wont solve my problem. Any help if appreciated. (This is really an XSLT question.) I haven't ever done it with javascript, but I understand that it can be done. See the bottom of: http://groups.yahoo.com/group/XSL-FO/message/3857 where a method for using java in XSLT (to get today's date) is demonstrated. Note also that this must be dependent on your XSLT engine, so check its docs or mailing lists for more specific information. Victor Mote - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Java script with xsl in FOP ?
You don't have the actual JavaScript do you? I find code usually works better than prose. -Original Message- From: Abhijit Junnare [mailto:[EMAIL PROTECTED] Sent: Friday, September 12, 2003 10:33 AM To: [EMAIL PROTECTED] Subject: RE: Java script with xsl in FOP ? [EMAIL PROTECTED] wrote: Can you paste the entire JavaScript functionality you are trying to emulate with XSLT, or is it too much? X-PATH is tricky, but you can do a lot with it. Here is some functionality that I would like to emulate in XSLT. I have some xml element called Name. I want to check the length of the Name element. If the string length for this is for example 10. I want to write it in a fixed width for example 20. So since I want the field to be fixed I want to add 10 fill charaters. The number of fill characters I want to add will vary as per the string length. Also the alignment can be different. If the alignment is center then I want to add fill characters before(here 5) and after (here 5) the actual Name. If alignment is left then I want to add fill characters (here 10)after the name and similarly for right aligned I want to add before the Name. Do you think something like this is feasible using XSL for variable lengths of the strings that come from xml? Your help is really appreciated. Thanks, Abhi --- Savino, Matt C [EMAIL PROTECTED] wrote: Can you paste the entire JavaScript functionality you are trying to emulate with XSLT, or is it too much? X-PATH is tricky, but you can do a lot with it. -Original Message- From: Abhijit Junnare [mailto:[EMAIL PROTECTED] Sent: Friday, September 12, 2003 10:25 AM To: [EMAIL PROTECTED] Subject: RE: Java script with xsl in FOP ? YES. The output will be pdf. So I dont want to proceed if I know that it wont work in the future. So I am asking everyone so that I can think what I should be doing. Abhi --- Savino, Matt C [EMAIL PROTECTED] wrote: Duh, I forgot this was the FOP board. Is this output going to PDF? I think PDF can also do some form of JavaScript processing but I've never tried. -Original Message- From: Savino, Matt C Sent: Friday, September 12, 2003 10:16 AM To: [EMAIL PROTECTED] Subject: RE: Java script with xsl in FOP ? As long as the calculations get done somewhere, either by the XLST processor or the browser, the end result should be the same correct? (Unless some other XSLT process is dependent on the outcome of these calcs.) -Original Message- From: Victor Mote [mailto:[EMAIL PROTECTED] Sent: Friday, September 12, 2003 10:11 AM To: [EMAIL PROTECTED] Subject: RE: Java script with xsl in FOP ? Abhijit Junnare wrote: Is it possible to use javascript inside the XSL that will be used with FOP. I need to do some calculations and so I need this. Is there any other way to do some basic math or some string manipulation? I know the string functions in xsl but I am afraid they wont solve my problem. Any help if appreciated. (This is really an XSLT question.) I haven't ever done it with javascript, but I understand that it can be done. See the bottom of: http://groups.yahoo.com/group/XSL-FO/message/3857 where a method for using java in XSLT (to get today's date) is demonstrated. Note also that this must be dependent on your XSLT engine, so check its docs or mailing lists for more specific information. Victor Mote - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
RE: Java script with xsl in FOP ?
Nope. I didnt write the code yet. I thought it would be better to know if it is worth trying before going long down the road. Sorry about that. If you still want the code I write it and send. Thanks Abhi --- Savino, Matt C [EMAIL PROTECTED] wrote: You don't have the actual JavaScript do you? I find code usually works better than prose. -Original Message- From: Abhijit Junnare [mailto:[EMAIL PROTECTED] Sent: Friday, September 12, 2003 10:33 AM To: [EMAIL PROTECTED] Subject: RE: Java script with xsl in FOP ? [EMAIL PROTECTED] wrote: Can you paste the entire JavaScript functionality you are trying to emulate with XSLT, or is it too much? X-PATH is tricky, but you can do a lot with it. Here is some functionality that I would like to emulate in XSLT. I have some xml element called Name. I want to check the length of the Name element. If the string length for this is for example 10. I want to write it in a fixed width for example 20. So since I want the field to be fixed I want to add 10 fill charaters. The number of fill characters I want to add will vary as per the string length. Also the alignment can be different. If the alignment is center then I want to add fill characters before(here 5) and after (here 5) the actual Name. If alignment is left then I want to add fill characters (here 10)after the name and similarly for right aligned I want to add before the Name. Do you think something like this is feasible using XSL for variable lengths of the strings that come from xml? Your help is really appreciated. Thanks, Abhi --- Savino, Matt C [EMAIL PROTECTED] wrote: Can you paste the entire JavaScript functionality you are trying to emulate with XSLT, or is it too much? X-PATH is tricky, but you can do a lot with it. -Original Message- From: Abhijit Junnare [mailto:[EMAIL PROTECTED] Sent: Friday, September 12, 2003 10:25 AM To: [EMAIL PROTECTED] Subject: RE: Java script with xsl in FOP ? YES. The output will be pdf. So I dont want to proceed if I know that it wont work in the future. So I am asking everyone so that I can think what I should be doing. Abhi --- Savino, Matt C [EMAIL PROTECTED] wrote: Duh, I forgot this was the FOP board. Is this output going to PDF? I think PDF can also do some form of JavaScript processing but I've never tried. -Original Message- From: Savino, Matt C Sent: Friday, September 12, 2003 10:16 AM To: [EMAIL PROTECTED] Subject: RE: Java script with xsl in FOP ? As long as the calculations get done somewhere, either by the XLST processor or the browser, the end result should be the same correct? (Unless some other XSLT process is dependent on the outcome of these calcs.) -Original Message- From: Victor Mote [mailto:[EMAIL PROTECTED] Sent: Friday, September 12, 2003 10:11 AM To: [EMAIL PROTECTED] Subject: RE: Java script with xsl in FOP ? Abhijit Junnare wrote: Is it possible to use javascript inside the XSL that will be used with FOP. I need to do some calculations and so I need this. Is there any other way to do some basic math or some string manipulation? I know the string functions in xsl but I am afraid they wont solve my problem. Any help if appreciated. (This is really an XSLT question.) I haven't ever done it with javascript, but I understand that it can be done. See the bottom of: http://groups.yahoo.com/group/XSL-FO/message/3857 where a method for using java in XSLT (to get today's date) is demonstrated. Note also that this must be dependent on your XSLT engine, so check its docs or mailing lists for more specific information. Victor Mote - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] === message truncated === __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED
RE: Java script with xsl in FOP ?
Yes, I think it is feasible. Here's some XSLT code we have that tests string length and forks based on the result: xsl:choose xsl:when test=string-length(@PRIMARY_ID) lt; 11 xsl:value-of select=@PRIMARY_ID / /xsl:when xsl:otherwise xsl:value-of select=substring(@PRIMARY_ID, 1, 10) /#xA0; xsl:value-of select=substring(@PRIMARY_ID, 11) / /xsl:otherwise /xsl:choose I think everything else you require would just involve a few more nested xsl:choose statements for the alignment types. -Original Message- From: Abhijit Junnare [mailto:[EMAIL PROTECTED] Sent: Friday, September 12, 2003 10:47 AM To: [EMAIL PROTECTED] Subject: RE: Java script with xsl in FOP ? Nope. I didnt write the code yet. I thought it would be better to know if it is worth trying before going long down the road. Sorry about that. If you still want the code I write it and send. Thanks Abhi --- Savino, Matt C [EMAIL PROTECTED] wrote: You don't have the actual JavaScript do you? I find code usually works better than prose. -Original Message- From: Abhijit Junnare [mailto:[EMAIL PROTECTED] Sent: Friday, September 12, 2003 10:33 AM To: [EMAIL PROTECTED] Subject: RE: Java script with xsl in FOP ? [EMAIL PROTECTED] wrote: Can you paste the entire JavaScript functionality you are trying to emulate with XSLT, or is it too much? X-PATH is tricky, but you can do a lot with it. Here is some functionality that I would like to emulate in XSLT. I have some xml element called Name. I want to check the length of the Name element. If the string length for this is for example 10. I want to write it in a fixed width for example 20. So since I want the field to be fixed I want to add 10 fill charaters. The number of fill characters I want to add will vary as per the string length. Also the alignment can be different. If the alignment is center then I want to add fill characters before(here 5) and after (here 5) the actual Name. If alignment is left then I want to add fill characters (here 10)after the name and similarly for right aligned I want to add before the Name. Do you think something like this is feasible using XSL for variable lengths of the strings that come from xml? Your help is really appreciated. Thanks, Abhi --- Savino, Matt C [EMAIL PROTECTED] wrote: Can you paste the entire JavaScript functionality you are trying to emulate with XSLT, or is it too much? X-PATH is tricky, but you can do a lot with it. -Original Message- From: Abhijit Junnare [mailto:[EMAIL PROTECTED] Sent: Friday, September 12, 2003 10:25 AM To: [EMAIL PROTECTED] Subject: RE: Java script with xsl in FOP ? YES. The output will be pdf. So I dont want to proceed if I know that it wont work in the future. So I am asking everyone so that I can think what I should be doing. Abhi --- Savino, Matt C [EMAIL PROTECTED] wrote: Duh, I forgot this was the FOP board. Is this output going to PDF? I think PDF can also do some form of JavaScript processing but I've never tried. -Original Message- From: Savino, Matt C Sent: Friday, September 12, 2003 10:16 AM To: [EMAIL PROTECTED] Subject: RE: Java script with xsl in FOP ? As long as the calculations get done somewhere, either by the XLST processor or the browser, the end result should be the same correct? (Unless some other XSLT process is dependent on the outcome of these calcs.) -Original Message- From: Victor Mote [mailto:[EMAIL PROTECTED] Sent: Friday, September 12, 2003 10:11 AM To: [EMAIL PROTECTED] Subject: RE: Java script with xsl in FOP ? Abhijit Junnare wrote: Is it possible to use javascript inside the XSL that will be used with FOP. I need to do some calculations and so I need this. Is there any other way to do some basic math or some string manipulation? I know the string functions in xsl but I am afraid they wont solve my problem. Any help if appreciated. (This is really an XSLT question.) I haven't ever done it with javascript, but I understand that it can be done. See the bottom of: http://groups.yahoo.com/group/XSL-FO/message/3857 where a method for using java in XSLT (to get today's date) is demonstrated. Note also
RE: Java script with xsl in FOP ?
Abhijit Junnare wrote: YES. The output will be pdf. So I dont want to proceed if I know that it wont work in the future. So I am asking everyone so that I can think what I should be doing. The eventual output is not so much the issue as whether you are trying to pass the code *through* XSLT to the output (i.e. embedding javascript in your html or pdf document), or whether you are trying to use the javascript within the XSLT transformation itself for purposes of outputting (in your case) XSL-FO code. I understand you to be doing the latter, in which case the technique I posted earlier will work *with java*, and you should be able to find a way to do it with javascript as well, at least with some XSLT engines. Certainly it is better to use pure XSLT if you can as that will be more portable. Victor Mote - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Java script with xsl in FOP ?
Dear Clay, Thanks for your help. The XSLT references you gave are really nice and I am sure that I can make things work now. Really appreciate your help. Regrds, Abhi --- Clay Leeds [EMAIL PROTECTED] wrote: Abhijit Junnare wrote: Dear Clay, Thanks much. May be you could help me since you have done some calculations. Let me know if you think its feasible or not. I have some xml element called Name. I want to check the length of the Name element. If the string length for this is for example 10. I want to write it in a fixed width for example 20. So since I want the field to be fixed I want to add 10 fill charaters. The number of fill characters I want to add will vary as per the string length. Also the alignment can be different. If the alignment is center then I want to add fill characters before(here 5) and after (here 5) the actual Name. If alignment is left then I want to add fill characters (here 10)after the name and similarly for right aligned I want to add before the Name. Do you think something like this is feasible using XSL for variable lengths of the strings that come from xml? Your help is really appreciated. Thanks, Abhi Please forgive that I'm responding to the list, but I want to ensure this discussion is public in the event others may find this thread useful. This is the link to the searchable (and excellent) xsl-list archive: http://www.biglist.com/lists/xsl-list/archives/ This thread on the xsl-list has some good info: http://www.biglist.com/lists/xsl-list/archives/200011/msg00817.html In addition, this DocBook library may have some useful templates: http://docbook.sourceforge.net/release/xsl/current/doc/lib/lib.html HTH! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]