2012-09-03 29 views
0

我有一個xsl腳本,它爲表單構建器添加了每個表單構建的常用功能。我希望在每次打開表單時在運行時應用腳本。我試着做以下爲http://wiki.orbeon.com/forms/how-to/other/implement-transformation-service解釋說:Orbeon通用/全局轉換服務

在/WEB-INF/resources/page-flow.xml我添加以下行

... 
<page path-info="/fr/([^/]+)/([^/]+)/(new|edit|view)(/([^/]+))?" 
matcher="oxf:perl5-matcher" view="test.xsl"/> 
... 

只是前行

<epilogue url="/config/epilogue.xpl"/> 

而且我還添加了test.xsl在/ WEB-INF /資源/應用/ FR /:

<xsl:stylesheet version="1.0" 
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
       xmlns:xhtml="http://www.w3.org/1999/xhtml"> 

    xsl:template match="@*|node()" name="identity"> 
     <xsl:copy> 
      <xsl:apply-templates select="@*|node()"/> 
     </xsl:copy> 
    </xsl:template> 

    <xsl:template match="/xhtml:html/xhtml:body"> 
     <xsl:copy> 
      <xforms:output value="'test'"/> 
      <xsl:apply-templates select="@*|node()"/> 
     </xsl:copy> 
    </xsl:template> 

</xsl:stylesheet> 

但S cript從來沒有適用於表格?我該如何解決這個問題?

回答

1

要專門爲Form Runner執行此操作,可以編輯unroll-form.xpl,例如在管道中的其他所有內容之前添加變換。你會在最後p:param後加入做到這一點:

<p:processor name="oxf:xslt"> 
    <p:input name="data" href="#data"/> 
    <p:input name="config" href="my-transformation.xsl"/> 
    <p:output name="data" id="transformed-data"/> 
</p:processor> 

然後重命名2次出現的#data#transformed-data。 (當然,你可以選擇名稱更能說明你的轉換是做什麼的。)