English 中文(简体)
为什么xsl:在<xsl:attribute>指示中填写了文件?
原标题:Why xsl:result-document fails inside <xsl:attribute> instruction?

I m using Saxon-EE 9.3.0.4 for xsl transformations and found that when <xsl:result-document> is used inside <xsl:attribute> (as well as <xsl:namespace>, <xsl:processing-instruction>) instruction, processor raises XTDE1480 error - Cannot switch to a final result destination while writing a temporary tree

<xsl:attribute name="a">
    <xsl:result-document href="result.xml" > - error here
        test
    </xsl:result-document>
</xsl:attribute>

http://www.w3.org/TR/xslt20/#element-result-document”rel=“nofollow” (Appendix D)允许父母填写<xsl:result-document>。 :

  • any XSLT element whose content model is sequence constructor
  • any literal result element

是否在Saxon或限制<xsl:result-document> 具体定义中没有定义的使用?

Update: I believe that this is not a good idea to use <xsl:result-document> inside <xsl:attribute>, but why error happens?

增 编

最佳回答

具体来说,你可以读到:

The instructions in the initial template are evaluated in final output state. An instruction is evaluated in the same output state as its calling instruction, except that xsl:variable, xsl:param, xsl:with-param, xsl:attribute, xsl:comment, xsl:processing-instruction, xsl:namespace, xsl:value-of, xsl:function, xsl:key, xsl:sort, and xsl:message always evaluate the instructions in their contained sequence constructor in temporary output state.

The xsl:result-document write in a final tree result, and given the rule above, I understand that it is an error to try writting in a final tree result when inside the following elements

xsl:variable, xsl:param, xsl:with-param, xsl:attribute, xsl:comment, xsl:process-instruction, xsl:namespace, xsl: Value-of, xsl:Function, xsl:key, xsl:sort, and xsl:message

问题回答

2018年的最新信息:注意到《国际公路货运公约》3.0 具体条款放宽了限制。 <代码>xsl:attribute和xsl:comment等指示不再规定临时输出国。 最近的Saxon版本(有9.8)执行修订后的规则。





相关问题
When test hanging in an infinite loop

I m tokenising a string with XSLT 1.0 and trying to prevent empty strings from being recognised as tokens. Here s the entire function, based on XSLT Cookbook: <xsl:template name="tokenize"> ...

quick xslt for-each question

Let s say I have an XML document that has this: <keywords> <keyword>test</keyword> <keyword>test2</keyword> <keyword>test3</keyword> <keyword>test4</...

XSLT Transform XML with Namespaces

I m trying to transform some XML into HTML using XSLT. Problem: I can t get it to work. Can someone tell me what I m doing wrong? XML: <ArrayOfBrokerage xmlns:i="http://www.w3.org/2001/...

XSLT output to HTML

In my XSLT file, I have the following: <input type="button" value= <xsl:value-of select="name">> It s an error as it violates XML rule. What I actually want is having a value from an ...

Mangling IDs and References to IDs in XML

I m trying to compose xml elements into each other, and the problem I am having is when there s the same IDs. Basically what I need to do is mangle all the IDs in an xml file, as well as the ...

Sharepoint 2007 Data view Webpart custom parameters

I m sort of new to the custom parameters that can be setup on a DataView Webpart. There are 6 options: - None - Control - Cookie - Form - QueryString - Server Variable I think that None, Cookie and ...

热门标签