xsl-list
[Top] [All Lists]

RE: [xsl] Document function isn't realoding document.

2008-01-12 01:44:03

I have very big problem with my XSLT transformation... I'm 
using Xalan, stylesheet is version 1.0. At some point of the 
transformation stylesheet reads value which is needed later 
in transformation. To avoid passing this variable through all 
apply-templates and using parameters in xsl:template I use 
xalan:redirect extension - simply write to file value of 
interesting element making with it XML document 
(<myValue>readed value</myValue>) and then I read that file with
document(myFile) function. 

The problem is when I change that 
file with consequents invoking of redirect:write instructions 
and read them again using processor doesn't see changes in 
that document - value of <myValue> is still the same as at 
the first time!

XSLT 1.0 requires that when you call document() twice with the same URI, the
two documents are identical. Most implementations are likely to achieve this
by caching the document.

xalan:redirect is of course an extension, so it can do anything it likes.
But with the XSLT 2.0 equivalent, xsl:result-document, you are explicitly
banned from trying to write a document and then reread it "later" in the
same transformation. The reason is that XSLT is not procedural so there is
no concept of "later". You are trying to avoid using XSLT the way it is
designed to be used, so it is not surprising that you have a big problem.

XSLT 2.0 has tunnel parameters which avoid the problem of passing parameters
through many layers of intermediate templates.

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>