For my initial tests, I've been using absolute paths for both the
@executable and and @dir attributes of my <exec> elements. If I leave the @dir attribute out, I see that it defaults to the WEB-INF/resources/apps directory of my orbeon installation inside of tomcat. Is there a way I can specify a relative path to my scripts? What I'd really to do is leave the target script in the same directory as my xpl file which references the script. This is the same directory as my page-flow.xml and other files. I've tried the following with various combinations with and without the oxf: prefix w/o any luck. ./apps/xxx/my_script.pl /apps/xxx/my_script.pl the following works: /path-to-tomcat/webapps/orbeon37/WEB-INF/resources/apps/xxx/my_script.pl But then I have to update the absolute paths when I copy my application to another directory. Alternatively is there a good way to put this kind of info into a properties file but then how do I reference these values? I'm going to need to do something like this for my data directory paths. Here's an example of what I have now: <p:processor name="oxf:execute-processor"> <p:input name="config"> <exec executable="/full-path-to-perl-script.pl" dir="/full-path-to-working-area"> <arg line="-flags /full-path-to-data-file"/> </exec> </p:input> <p:output name="stdout" id="stdout"/> <p:output name="stderr" id="stderr"/> <p:output name="result" id="result"/> </p:processor> claude -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Claude,
I am fairly sure there is now a better way, but previously it has been suggested that you can use the java processor to call your java class which does this: ExternalContext externalContext = (ExternalContext) context.getAttribute(PipelineContext.EXTERNAL_CONTEXT); String realPath = externalContext.getRealPath("WEB-INF"); http://www.orbeon.com/ops/doc/processors-java --Hank On May 20, 2009, at 5:00 PM, claude felizardo wrote: > For my initial tests, I've been using absolute paths for both the > @executable and and @dir attributes of my <exec> elements. If I > leave the @dir attribute out, I see that it defaults to the WEB-INF/ > resources/apps directory of my orbeon installation inside of > tomcat. Is there a way I can specify a relative path to my > scripts? What I'd really to do is leave the target script in the > same directory as my xpl file which references the script. This is > the same directory as my page-flow.xml and other files. > > I've tried the following with various combinations with and without > the oxf: prefix w/o any luck. > > ./apps/xxx/my_script.pl > /apps/xxx/my_script.pl > > the following works: > > /path-to-tomcat/webapps/orbeon37/WEB-INF/resources/apps/xxx/ > my_script.pl > > But then I have to update the absolute paths when I copy my > application to another directory. > > Alternatively is there a good way to put this kind of info into a > properties file but then how do I reference these values? I'm > going to need to do something like this for my data directory paths. > > Here's an example of what I have now: > > <p:processor name="oxf:execute-processor"> > <p:input name="config"> > <exec executable="/full-path-to-perl-script.pl" dir="/ > full-path-to-working-area"> > <arg line="-flags /full-path-to-data-file"/> > </exec> > </p:input> > <p:output name="stdout" id="stdout"/> > <p:output name="stderr" id="stderr"/> > <p:output name="result" id="result"/> > </p:processor> > > > claude > > > -- > You receive this message as a subscriber of the [hidden email] > mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws NEES@UCSB Institute for Crustal Studies, University of California, Santa Barbara 805-893-8042 -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Hmm, so far I have not had to write a single line of Java. It's all
been in xml files. My application is basically a web front end to a bunch of perl scripts that are being written by someone else so I am a bit hesitant to add Java at this point. I guess I'm basically looking for examples on how to define some properties in an xml file and then reference them in my xpl files which I'm using as wrappers for the perl stuff. I did a test of calling 'env' and it looks like my PATH variable as defined when I launch tomcat is intact so I might be able to just add the path to the perl scripts but I'd rather not do that. Oh, I might even be able to add '.' to my path but again, I'd prefer to not have to do that either. Hmm, specifying <exec executable="./myscript.pl"> didn't work. ;( Oh, but adding . to my PATH before starting tomcat seems to work. It's a workaround but there's got to be a cleaner solution. claude Hank Ratzesberger wrote: > Claude, > > I am fairly sure there is now a better way, but > previously it has been suggested that you can use > the java processor to call your java class which > does this: > > ExternalContext externalContext > = (ExternalContext) > context.getAttribute(PipelineContext.EXTERNAL_CONTEXT); > String realPath = externalContext.getRealPath("WEB-INF"); > > http://www.orbeon.com/ops/doc/processors-java > > --Hank > > > On May 20, 2009, at 5:00 PM, claude felizardo wrote: > >> For my initial tests, I've been using absolute paths for both the >> @executable and and @dir attributes of my <exec> elements. If I >> leave the @dir attribute out, I see that it defaults to the >> WEB-INF/resources/apps directory of my orbeon installation inside of >> tomcat. Is there a way I can specify a relative path to my >> scripts? What I'd really to do is leave the target script in the >> same directory as my xpl file which references the script. This is >> the same directory as my page-flow.xml and other files. >> >> I've tried the following with various combinations with and without >> the oxf: prefix w/o any luck. >> >> ./apps/xxx/my_script.pl >> /apps/xxx/my_script.pl >> >> the following works: >> >> /path-to-tomcat/webapps/orbeon37/WEB-INF/resources/apps/xxx/my_script.pl >> >> But then I have to update the absolute paths when I copy my >> application to another directory. >> >> Alternatively is there a good way to put this kind of info into a >> properties file but then how do I reference these values? I'm going >> to need to do something like this for my data directory paths. >> >> Here's an example of what I have now: >> >> <p:processor name="oxf:execute-processor"> >> <p:input name="config"> >> <exec executable="/full-path-to-perl-script.pl" >> dir="/full-path-to-working-area"> >> <arg line="-flags /full-path-to-data-file"/> >> </exec> >> </p:input> >> <p:output name="stdout" id="stdout"/> >> <p:output name="stderr" id="stderr"/> >> <p:output name="result" id="result"/> >> </p:processor> >> >> >> claude > > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
Claude,
Assuming you declare the following in your config/properties-local.xml: <property as="xs:string" name="claude.own.property" value="some value"/> You can then access this in XSLT with: <xsl:value-of select="pipeline:property('claude.own.property')"/> Or in general, you can use pipeline:property() anywhere you have XPath. You'll also need the following namespace mapping for the "pipeline" prefix: xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary" This way you should be able to access your own properties in the code that creates the config for the execute-processor. Do you think that this could do the trick? Alex |
Having problems trying to call property() function from within an xpl
file. Is this supported? I'm getting the following error: XPath syntax error at char 33 on line 17 in {p:property('blah blah blah...}: Cannot find a matching 1-argument function named {http://www.orbeon.com/oxf/pipeline}property(). Note: external function calls have been disabled How do you enable external functions? Here's what I'm currently trying inside of my test.xpl file: <p:processor name="oxf:xslt"> <p:input name="config"> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:variable name="dir"><xsl:value-of select="p:property('oxf.xforms.password')"/></xsl:variable> <xsl:variable name="executable">echo</xsl:variable> <xsl:variable name="filename"><xsl:value-of select="/*/filename"/></xsl:variable> <exec> <xsl:attribute name="dir"><xsl:value-of select="$dir"/></xsl:attribute> <xsl:attribute name="executable"><xsl:value-of select="$executable"/></xsl:attribute> </exec> </xsl:template> </xsl:stylesheet> </p:input> <p:input name="data" href="#instance"/> <p:output name="data" id="exec-config"/> </p:processor> ... Sorry if it doesn't quite make sense as I've been trying different things trying to isolate the problem so the 'echo' doesn't quite match. Anyway I tried a bunch of searches and see that there were a few RFE's (requests for enhancements?) back in 2008 for either support for xxforms:property() or p:property() in either XPL or xforms. I did try adding both pipleline and xxforms at the top of my page: <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:oxf="http://www.orbeon.com/oxf/processors" xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> claude Alessandro Vernet wrote: > Claude, > > > cfeliz wrote: > >> I guess I'm basically looking for examples on how to define some >> properties in an xml file and then reference them in my xpl files which >> I'm using as wrappers for the perl stuff. >> >> > > Assuming you declare the following in your config/properties-local.xml: > > <property as="xs:string" name="claude.own.property" value="some value"/> > > You can then access this in XSLT with: > > <xsl:value-of select="pipeline:property('claude.own.property')"/> > > Or in general, you can use pipeline:property() anywhere you have XPath. > You'll also need the following namespace mapping for the "pipeline" prefix: > > xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary" > > This way you should be able to access your own properties in the code that > creates the config for the execute-processor. Do you think that this could > do the trick? > > Alex > > ----- > Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise > Orbeon's Blog: http://www.orbeon.com/blog/ > Personal Blog: http://avernet.blogspot.com/ > Twitter - http://twitter.com/avernet > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Claude,
> Having problems trying to call property() function from within an xpl > file. Is this supported? I'm getting the following error: > > > XPath syntax error at char 33 on line 17 in {p:property('blah blah > blah...}: > Cannot find a matching 1-argument function named > {http://www.orbeon.com/oxf/pipeline}property(). Note: external function > calls have been disabled > > How do you enable external functions? transformer pipelines "unsafe-xslt" or "unsafe-saxon" that may be an issue, but first it does not appear that you have declared the pipeline namspace, which I will shorten to pipe, and is different than the processor namespace (usually p: ) <config xmlns:pipe="xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:transform> <xsl:variable name="dir" select="pipe:property('oxf.xforms.password')"/> </xsl:transform> </config> --Hank > > Here's what I'm currently trying inside of my test.xpl file: > > <p:processor name="oxf:xslt"> > <p:input name="config"> > <xsl:stylesheet version="2.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > > <xsl:template match="/"> > <xsl:variable name="dir"><xsl:value-of > select="p:property('oxf.xforms.password')"/></xsl:variable> > <xsl:variable name="executable">echo</xsl:variable> > <xsl:variable name="filename"><xsl:value-of > select="/*/filename"/></xsl:variable> > <exec> > <xsl:attribute name="dir"><xsl:value-of > select="$dir"/></xsl:attribute> > <xsl:attribute name="executable"><xsl:value-of > select="$executable"/></xsl:attribute> > </exec> > </xsl:template> > </xsl:stylesheet> > </p:input> > <p:input name="data" href="#instance"/> > <p:output name="data" id="exec-config"/> > </p:processor> > ... > > Sorry if it doesn't quite make sense as I've been trying different > things trying to isolate the problem so the 'echo' doesn't quite match. > Anyway I tried a bunch of searches and see that there were a few RFE's > (requests for enhancements?) back in 2008 for either support for > xxforms:property() or p:property() in either XPL or xforms. > > I did try adding both pipleline and xxforms at the top of my page: > > <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" > xmlns:oxf="http://www.orbeon.com/oxf/processors" > xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary" > xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > > claude > > > Alessandro Vernet wrote: >> Claude, >> >> >> cfeliz wrote: >> >>> I guess I'm basically looking for examples on how to define some >>> properties in an xml file and then reference them in my xpl files which >>> I'm using as wrappers for the perl stuff. >>> >>> >> >> Assuming you declare the following in your config/properties-local.xml: >> >> <property as="xs:string" name="claude.own.property" value="some value"/> >> >> You can then access this in XSLT with: >> >> <xsl:value-of select="pipeline:property('claude.own.property')"/> >> >> Or in general, you can use pipeline:property() anywhere you have XPath. >> You'll also need the following namespace mapping for the "pipeline" >> prefix: >> >> xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary" >> >> This way you should be able to access your own properties in the code >> that >> creates the config for the execute-processor. Do you think that this >> could >> do the trick? >> >> Alex >> >> ----- >> Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise >> Orbeon's Blog: http://www.orbeon.com/blog/ >> Personal Blog: http://avernet.blogspot.com/ >> Twitter - http://twitter.com/avernet >> > > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
I wasn't able to figure out how to use xsl:transform in my .xpl file, I
kept getting errors about tag name "xsl:transform" not allowed or something like that as I tried inserting it in different places. Looks like all I needed was to specify oxf:unsafe-xslt instead of just oxf:xslt. Here's the first few lines with the pipleline declaration and the first few processors: <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:oxf="http://www.orbeon.com/oxf/processors" xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <p:param name="instance" type="input" /> <!-- Create the exec-processor config --> <p:processor name="oxf:unsafe-xslt"> <p:input name="config"> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:variable name="cmd">pwd</xsl:variable> <xsl:variable name="args"><xsl:value-of select="/*/filename"/></xsl:variable> <exec> <xsl:attribute name="dir" select="pipeline:property('my.script-path')"/> <xsl:attribute name="executable" select="$cmd"/> <xsl:element name="arg"><xsl:attribute name="line" select="$args"/></xsl:element> </exec> </xsl:template> </xsl:stylesheet> </p:input> <p:input name="data" href="#instance"/> <p:output name="data" id="exec-config"/> </p:processor> <!-- Execute command --> <p:processor name="oxf:execute-processor"> <p:input name="config" href="#exec-config"/> <p:output name="stdout" id="stdout"/> <p:output name="stderr" id="stderr"/> <p:output name="result" id="result"/> </p:processor> ... BTW, it looks like if any of the properties has the pattern 'password', then any attempts to use it in <xforms:output> results in nothing returned. A nice security feature but not one I saw documented anywhere. claude Hank Ratzesberger wrote: > Claude, > > >> Having problems trying to call property() function from within an xpl >> file. Is this supported? I'm getting the following error: >> >> >> XPath syntax error at char 33 on line 17 in {p:property('blah blah >> blah...}: >> Cannot find a matching 1-argument function named >> {http://www.orbeon.com/oxf/pipeline}property(). Note: external function >> calls have been disabled >> >> How do you enable external functions? >> > > To enable external functions, you use the special > transformer pipelines "unsafe-xslt" or "unsafe-saxon" > that may be an issue, but first it does not appear > that you have declared the pipeline namspace, which > I will shorten to pipe, and is different than the > processor namespace (usually p: ) > > <config > xmlns:pipe="xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > > <xsl:transform> > <xsl:variable name="dir" > select="pipe:property('oxf.xforms.password')"/> > </xsl:transform> > > </config> > > --Hank > > >> Here's what I'm currently trying inside of my test.xpl file: >> >> <p:processor name="oxf:xslt"> >> <p:input name="config"> >> <xsl:stylesheet version="2.0" >> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> >> >> <xsl:template match="/"> >> <xsl:variable name="dir"><xsl:value-of >> select="p:property('oxf.xforms.password')"/></xsl:variable> >> <xsl:variable name="executable">echo</xsl:variable> >> <xsl:variable name="filename"><xsl:value-of >> select="/*/filename"/></xsl:variable> >> <exec> >> <xsl:attribute name="dir"><xsl:value-of >> select="$dir"/></xsl:attribute> >> <xsl:attribute name="executable"><xsl:value-of >> select="$executable"/></xsl:attribute> >> </exec> >> </xsl:template> >> </xsl:stylesheet> >> </p:input> >> <p:input name="data" href="#instance"/> >> <p:output name="data" id="exec-config"/> >> </p:processor> >> ... >> >> Sorry if it doesn't quite make sense as I've been trying different >> things trying to isolate the problem so the 'echo' doesn't quite match. >> Anyway I tried a bunch of searches and see that there were a few RFE's >> (requests for enhancements?) back in 2008 for either support for >> xxforms:property() or p:property() in either XPL or xforms. >> >> I did try adding both pipleline and xxforms at the top of my page: >> >> <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" >> xmlns:oxf="http://www.orbeon.com/oxf/processors" >> xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary" >> xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" >> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> >> >> claude >> >> >> Alessandro Vernet wrote: >> >>> Claude, >>> >>> >>> cfeliz wrote: >>> >>> >>>> I guess I'm basically looking for examples on how to define some >>>> properties in an xml file and then reference them in my xpl files which >>>> I'm using as wrappers for the perl stuff. >>>> >>>> >>>> >>> Assuming you declare the following in your config/properties-local.xml: >>> >>> <property as="xs:string" name="claude.own.property" value="some value"/> >>> >>> You can then access this in XSLT with: >>> >>> <xsl:value-of select="pipeline:property('claude.own.property')"/> >>> >>> Or in general, you can use pipeline:property() anywhere you have XPath. >>> You'll also need the following namespace mapping for the "pipeline" >>> prefix: >>> >>> xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary" >>> >>> This way you should be able to access your own properties in the code >>> that >>> creates the config for the execute-processor. Do you think that this >>> could >>> do the trick? >>> >>> Alex >>> >>> ----- >>> Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise >>> Orbeon's Blog: http://www.orbeon.com/blog/ >>> Personal Blog: http://avernet.blogspot.com/ >>> Twitter - http://twitter.com/avernet >>> >>> >> > > > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
Claude,
xsl:transform is just another name for xsl:stylesheet; it should just work in the same way. It doesn't in your case? That's right. By "default" (i.e. when using oxf:xslt), calling functions from Java code is not allowed for security reasons. Good point; we should have this documented! I added this on the wiki: http://wiki.orbeon.com/forms/doc/developer-guide/configuration-properties#TOC-Defining-your-own-properties Alex |
Alessandro Vernet wrote:
> Claude, > > > cfeliz wrote: > >> I wasn't able to figure out how to use xsl:transform in my .xpl file, I >> kept getting errors about tag name "xsl:transform" not allowed or >> something like that as I tried inserting it in different places. >> >> > > xsl:transform is just another name for xsl:stylesheet; it should just work > in the same way. It doesn't in your case? > been something else that was wrong with my syntax. Just tried 3.7.1 and 3.7.0.beta ( I think it was like May 02 ) and both work fine. I was probably trying to insert a transform inside of a stylesheet. Should I use xsl:transform instead of xsl:stylesheet ? > > cfeliz wrote: > >> Looks like all I needed was to specify oxf:unsafe-xslt instead of just >> oxf:xslt. >> >> > > That's right. By "default" (i.e. when using oxf:xslt), calling functions > from Java code is not allowed for security reasons. > track this down but I wasn't sure if I needed to specify unsafe as I was editing an xpl file and not java. > > cfeliz wrote: > >> BTW, it looks like if any of the properties has the pattern 'password', >> then any attempts to use it in <xforms:output> results in nothing >> returned. A nice security feature but not one I saw documented anywhere. >> >> > > Good point; we should have this documented! I added this on the wiki: > > http://wiki.orbeon.com/forms/doc/developer-guide/configuration-properties#TOC-Defining-your-own-properties > or 'xxxx' instead of nothing so that at least you get something. BTW, when I go to the top of the developer guide: http://wiki.orbeon.com/forms/doc/developer-guide nothing shows up but it says there are 22 subpages. If I click on the "View All" link nothing happens and on my browser status bar, it just says "javascript:;". Broken link? claude > Alex > > ----- > Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise > Orbeon's Blog: http://www.orbeon.com/blog/ > Personal Blog: http://avernet.blogspot.com/ > Twitter - http://twitter.com/avernet > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
Claude,
It is really up to you. I use xsl:stylesheet just because I am used to it, but the we use XSLT nowadays often doesn't have anything to do with the "style" of the page. So I understand why some would consider xsl:transform to be a better name. As far as I am concerned, I don't think the name matters that much ;). Make sense. I added an RFE for this: http://forge.ow2.org/tracker/index.php?func=detail&aid=313802&group_id=168&atid=350207 BTW, if you want to give it a go, we'll be glad to incorporate your change. It's just that this page hasn't been edited to list all the sub-pages. Those intermediary pages are there to give more hierarchy to the wiki, and it would be annoying to have to edit them every time we add/rename another page. So I just removed those links in the sidebar. Instead, just click on "Sitemap", and you will see the structure of the site. Alex |
Administrator
|
In reply to this post by claude felizardo
> Yes, I see that now. much better. But may I suggest it output
Grunt. This is due to Google Site's broken UI I think.
> '****' or 'xxxx' instead of nothing so that at least you get > something. > > BTW, when I go to the top of the developer guide: > > http://wiki.orbeon.com/forms/doc/developer-guide > > nothing shows up but it says there are 22 subpages. If I click on > the "View All" link nothing happens and on my browser status bar, it > just says "javascript:;". Broken link? The best way to look at all the documents is to go to: http://wiki.orbeon.com/forms/system/app/pages/sitemap/hierarchy and then select "Expand all". -Erik -- Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.com/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |