Re: [xsl] Get extern xml document represented by a string

Subject: Re: [xsl] Get extern xml document represented by a string
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Mon, 10 Dec 2001 17:36:46 +0000
Hi Paulo,

> How can I get another xml document, represented by a string, to use
> in my xslt?

There isn't anything in XSLT that will let you do this. There are
several possibilities that might be appropriate depending on how
you're calling Xalan (from a command line? within Cocoon? within some
Java code?):

 - in the code that calls Xalan, parse the string into a DOM and pass
   that DOM in as a parameter to the stylesheet.

 - construct an Entity Resolver that recognises a 'URL' for the
   document, and use the document() function to access the DOM from
   within the stylesheet.

 - use a two-step process in which you first create an XML document
   based on a string, and then transform that XML document.

 - write an XML parser using XSLT and use that to parse the string.

The last one is a joke :)



It would be nice if XSLT processors supported the data: URI schema
because then you could just do:

  document(concat('data:text/xml,' + $string))

to get hold of the XML document.

Jeni Tennison

 XSL-List info and archive:

Current Thread