This is actually quite easy. The controller gives you the possibility to pass groups matched by the regexp matcher into the XForms instance. There is an example here:
http://www.orbeon.com/oxf/doc/reference-controller#N10225
So you have to create an XForms model, for example:
<xf:model xmlns:xf="http://www.w3.org/2002/xforms"> <xf:instance> <form> <path/> </form> </xf:model>
Then, pass the instance to your default.xpl:
<p:param name="instance" type="input"/>
Then, you can access to the path with /form/path. What you probably want to do at that point is use the URL generator to create the local URL, for example:
<p:processor uri="oxf/processor/url-generator">
<p:input name="config" href="aggregate('config', #instance#xpointer(concat('oxf:/', /form/path)))"/>
<p:output name="data" id="file"/>
</p:processor>
What I am doing here in the input href is creating a configuration document for the URL generator. You may also do this with XSLT:
<p:processor uri="oxf/processor/xslt">
<p:input name="data" href="#instance"/>
<p:input name="config">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<config><xsl:value-of select="/form/path"/></config>
</xsl:template>
</xsl:stylesheet>
</p:input>
<p:output name="data" id="url-config"/>
</p:processor>
Which is even easier with XSLT 2.0:
<p:processor uri="oxf/processor/xslt-2.0">
<p:input name="data" href="#instance"/>
<p:input name="config">
<config xsl:version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:value-of select="/form/path"/>
</config>
</p:input>
<p:output name="data" id="url-config"/>
</p:processor>
You can reference the data by referring to href="#file" in a processor input.
If the file is actually an HTML file, you will have to specify the content-type in the generator:
<p:processor uri="oxf/processor/xslt-2.0">
<p:input name="data" href="#instance"/>
<p:input name="config">
<config xsl:version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<url><xsl:value-of select="/form/path"/></url>
<content-type>text/html</content-type>
</config>
</p:input>
<p:output name="data" id="url-config"/>
</p:processor>
You have to use the URL generator because the input href="..." only support statically constructed references to either URLs (e.g. href="oxf:/myfile.html"), or references to processor outputs or pipeline inputs (e.g. href="#my-output").
I hope this helps.
-Erik
Hank Ratzesberger wrote:
> I would like to have a default pipeline get
> applied to all files of the same type. My
> default pipleline converts the html to xsl, then
> runs the xsl with a preferences xml file to get
> site-wide defaults.
>
> All *.html files should have this two-step
> processing, convert to XSL, transform with the
> preferences XML file.
>
> I guess the problem is I don't know how to
> reference the file the controller is looking at,
> that is, what is the local directory for the file?
> I need to pass that url as the data input to
> my first processor statement.
>
> (BTW, is the html serializer necessary?)
>
> Thanks for any tips.
> --Hank
>
> ============================================
> Replying to a list? I'll get my copy there!
>
> Hank Ratzesberger
> http://crustal.ucsb.edu/ | http://neesgrid.org/
> Institute for Crustal Studies
> University of California, Santa Barbara
> ============================================
>
>
>
>
> Snippet from controller.xml:
>
> <page path-info="/(*.html)"
> matcher="oxf/processor/perl5-matcher"
> model="oxf:/default.xpl">
> </page>
>
>
> default.xpl:
>
>
> <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline">
>
> <!-- Transform the xhtml into a stylesheet -->
> <!-- This step is only for preview pages -->
>
> <p:processor uri="oxf/processor/xslt">
> <p:input name="config" href="./index.xsl"/>
> <!-- WHERE IS THIS URL? THE ONE GETTING EVALUATED IN CONTROLLER.XML? -->
> <p:input name="data" href="./index.html"/>
> <p:output name="data" id="xsl"/>
> </p:processor>
>
>
> <!-- Process xml data with stylesheet. All inputs are aggregated under /root -->
>
> <p:processor uri="oxf/processor/xslt">
> <p:input name="config" href="#xsl"/>
> <p:input name="data" href="aggregate('root', /site-prefs.xml)"/>
> <p:output name="data" id="data"/>
> </p:processor>
>
>
> <!-- Deliver html -->
>
> <p:processor uri="oxf/processor/html-serializer">
> <p:input name="config">
> <config/>
> </p:input>
> <p:input name="data" href="#data"/>
> </p:processor>
>
> </p:config>
>
>
> _______________________________________________
> oxf-users mailing list
> [EMAIL PROTECTED]
> http://mail.orbeon.com/mailman/listinfo/oxf-users
_______________________________________________ oxf-users mailing list [EMAIL PROTECTED] http://mail.orbeon.com/mailman/listinfo/oxf-users
