Subject: [xsl] Explicit document node creation From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Thu, 10 Jan 2002 15:46:48 +0000 |
Hi, Thinking about the whole sequence generation thing, it struck me that what xsl:result-document actually does is create a node (just like xsl:element etc.) - a document node. The sequence generated from its content constructor forms the children of the document node, and the attributes (format and href) give instructions about where that document should go. If you view it like this, I think that xsl:document is the more appropriate name (because it ties in with xsl:element etc.). I also think that you should be able to create documents that *don't* have a destination indicated by an href attribute (I'll call these anonymous documents). The handling of an anonymous document depends on where the sequence containing the anonymous document is produced: - if it's produced from the content of a variable-binding element, then the variable is bound to that document node (actually the sequence that includes that document node) - if it's produced from the content of an xsl:message, then the document is written to an implementation-defined destination for error messages (e.g. stderr) - if it's produced from the stylesheet as a whole, then the document is written to an implementation-defined destination for the result of the transformation (e.g. stdout) Note that it should always be a dynamic error if there's more than one anonymous document in a sequence. For backwards compatability with XSLT 1.0 (and for convenience), if the result sequence consists of documentless nodes, an anonymous document should be implicitly created in certain circumstances: - by variable-binding elements, if they don't have a type attribute or have a type attribute with the value "document" (or whatever DataType expression is used to indicate a document node) - by xsl:message - by the stylesheet as a whole >From this, there would be a constraint on the sequence constructors for the stylesheet as a whole for and for xsl:message: they would need to either consist entirely of document nodes (with different destinations), or consist entirely of documentless nodes. If you wanted to generate multiple documents, you'd need to use xsl:document to create the main document as well as the subsiduary ones. Also, you wouldn't be able to construct a document node while you were in the middle of constructing another document. This is a very different model from the 'tree of documents' approach of the current XSLT 2.0 WD, the XSLT 1.1 WD and most extension elements. I'm not sure whether this restriction makes it impractical (or any more impractical than the current restriction that you can't create a secondary result document within a variable). It could mean additional processing because, for example, you couldn't run through a bunch of nodes, creating a secondary result document for each node at the same time as creating a link in the main result document. You'd have to run through the same set of nodes twice in order to create the two different bits of content. On the other hand, that restriction (you can only do one thing at a time) is true elsewhere in XSLT, so why shouldn't it be true when it comes to creating documents? Thoughts? Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] xpath, Jarno . Elovirta | Thread | [xsl] pruebas, Pep Coll |
Re: [xsl] Re: XPath to calculate to, Lee Goddard | Date | [xsl] pruebas, Pep Coll |
Month |