是否可以匹配"任何尚未匹配/处理的节点"?最好不要将我的样式表变成一个巨大的for-each/Choose语句,因为当前的排序很关键.
该项目仍处于开发阶段,已经在现场环境中使用,因此代码简单地处于快速变化状态以响应我们正在进入的实时数据.我正在通过FO从XML生成PDF文档可能还有其中我还不知道的节点,并希望在我的XSL-FO转换中添加一个"故障转移"指令,将所有未计入的节点放在文档的开头,为红色,加快发现.
我不能忽略惊喜节点,因为需要处理数据.我可以更快地找到"孤儿"数据,我可以更快地得到正确处理和出门.
我试过玩<xsl:template match="*">...</xsl:template>各种优先级=""设置,但当然它适用于每个节点.
例如,我可能在一个部分中有这个,因为这些XML块不保证以正确的输出顺序出现.(代码块格式化对我来说不起作用 - 四个空格缩进没有结果,对不起:(
<xsl:template match="AccountSummary">
<fo:block margin-left="2" space-before="1" space-after="1" text-align="center">
<xsl:apply-templates select="Label"/>
</fo:block>
<xsl:apply-templates select="AccountInfo"/>
<xsl:apply-templates select="AccountProfile"/>
<xsl:apply-templates select="ChangeInValueOfAccounts"/>
<!-- ... more goes here -->
</xsl:template>
Run Code Online (Sandbox Code Playgroud)
我想做点什么
<xsl:template match="AccountSummary">
<fo:block margin-left="2" space-before="1" space-after="1" text-align="center">
<xsl:apply-templates select="Label"/>
</fo:block>
<xsl:apply-templates select="AccountInfo"/>
<xsl:apply-templates select="AccountProfile"/>
<xsl:apply-templates select="ChangeInValueOfAccounts"/>
<!-- ... more goes here -->
<xsl:for-each select="not otherwise matched">
<!-- call zomgRED template -->
</xsl:for-each>
</xsl:template>
Run Code Online (Sandbox Code Playgroud)
理想情况下,我宁愿将zomgREDs放在顶部,但在底部也会起作用.或标记文本标记.任何东西吐出最终文件中的文本而不是默默地吃它.