简体   繁体   English

Orbeon XBL 和 xxbl:transform

[英]Orbeon XBL and xxbl:transform

I'm still in the early stages of understanding and learning to use XBL components.我仍处于理解和学习使用 XBL 组件的早期阶段。 I am experimenting with using a stylesheet to generate an HTML "report" on the contents of a node in the main instance (putting aside for now the issue of updating it if that node changes).我正在尝试使用样式表在主实例中的节点内容上生成 HTML“报告”(暂时搁置该节点更改时更新它的问题)。 I can get the stylesheet to run and generate the HTML without any values in it, but I'm still trying to understand how to get the data to the stylesheet.我可以让样式表运行并生成没有任何值的 HTML,但我仍在尝试了解如何将数据获取到样式表。 I looked at the "XForm Sandbox" example " xbl-xslt.xhtml ", which does run in my application.我查看了“XForm Sandbox”示例“ xbl-xslt.xhtml ”,它确实在我的应用程序中运行。 That example uses an xform repeat inside the custom tag, and in the stylesheet has a template with a match referring to the custom tag, so I assume that's how the stylesheet gets its data.该示例在自定义标记内使用 xform 重复,并且样式表中有一个模板,该模板具有引用自定义标记的匹配项,因此我假设样式表就是这样获取其数据的。

I don't want it to generate any XForm markup, just HTML.我不希望它生成任何 XForm 标记,只生成 HTML。 On the XBL binding, I am using xxbl:mode="binding" as an attribute.在 XBL 绑定上,我使用xxbl:mode="binding"作为属性。 I would like to just put a ref attribute on the custom tag, but I can't figure out how to pass the data to the stylesheet.我只想在自定义标记上放置一个ref属性,但我不知道如何将数据传递给样式表。 (Currently in my stylesheet, everything is under a <xsl:template match="/"> element.) I noticed the "alternate table" example has this: (目前在我的样式表中,所有内容都在<xsl:template match="/">元素下。)我注意到“备用表”示例具有以下内容:

<xsl:template match="@*|node()">
    <xsl:copy>
         <xsl:if test="/*">
              <xsl:attribute name="xxbl:scope">outer</xsl:attribute>
         </xsl:if>
         <xsl:apply-templates select="@*[not(name() = ('style1', 'style2'))]|node()"/>
    </xsl:copy>
</xsl:template>

and this:和这个:

<xsl:template match="foo:table-alternate">
  <xh:table>
      <xsl:apply-templates select="@*|node()"/>
  </xh:table>
</xsl:template>

I imagine are the keys to this working, but how could I simply add a ref attribute on the custom tag of my xbl and have this work?我想这是这项工作的关键,但我怎么能简单地在我的 xbl 的自定义标签上添加一个ref属性并让这项工作? I have been looking through the Orbeon documentation, the "sandbox" examples, and elsewhere, but I probably am still misunderstanding some basic principles of XBL components.我一直在浏览 Orbeon 文档、“沙箱”示例和其他地方,但我可能仍然误解了 XBL 组件的一些基本原则。 Can anyone point me in the right direction?任何人都可以指出我正确的方向吗?

Are you saying that you would like to pass the data in the node bound to your component to the XSLT?您是说要将绑定到您的组件的节点中的数据传递给 XSLT 吗? If so, that isn't possible, and it isn't how XSLT is expected to be used in conjunction with XBL.如果是这样,那是不可能的,这也不是 XSLT 与 XBL 结合使用的方式。

Think of XSLT in XBL as macros in some other languages, as a form of meta-programming , which allows you to have code running at "form compilation time", with that code being able to generate XForms and HTML.将 XBL 中的 XSLT 视为其他一些语言中的宏,作为元编程的一种形式,它允许您在“表单编译时”运行代码,并且该代码能够生成 XForms 和 HTML。 Since it runs at "compilation time", data isn't available yet.由于它在“编译时”运行,因此数据尚不可用。 The main language is still XForms, and in most cases, you shouldn't need to use XSLT in your XBL components.主要语言仍然是 XForms,在大多数情况下,您不需要在 XBL 组件中使用 XSLT。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM