This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Serializing external XML documents
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Serializing external XML documents
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Wed, 10 Oct 2001 15:11:33 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
> 1) I am using "document()" function (maybe abusing of it) to
> talk HTTP with
> an external application: Tamino DB.
>
> Question: Is there any other XSLT standard way of talking
> HTTP from inside a stylesheet ?
No, the document() function is the only way of communicating with the
outside world, other than using an extension function.
>
> 2) One of the possible calls to Tamino is a "_process"
> function for content
> updating purposes. The syntax for this function is:
>
> DB-URL?_process=<XML object> (XML object stands for a text
> serialized XML fragment)
If you use the document() function with a URL that has side-effects, you're
in the same kind of dangerous territory as using an extension function with
side-effects. In general, you don't know the order in which XSLT
instructions are executed, or whether they are executed once or many times.
If you don't use the value returned by document(), you don't know whether
the command will be executed at all. (Actually, with document(), it's pretty
certain that if you call document() twice with the same URL, the underlying
HTTP request will only happen once).
>
> Question: What is the most practical way of reading an
> external XML-file
> with the desired target XML information and serialize it as
> non-escaped XML
> markup text and insert it into the "document()" function to
> perform the HTTP call ?
>
I think the answer to that is to use a JAXP URIResolver. Don't try to
include the actual XML in the URI passed to document(), instead use some
kind of abstract URI, and convert this to the real HTTP request in your
URIResolver.
Mike Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list