Re: Fwd: RE: [xsl] Expected behavior for parsed source containing xsl?

Subject: Re: Fwd: RE: [xsl] Expected behavior for parsed source containing xsl?
From: Trevor Nash <tcn@xxxxxxxxxxxxx>
Date: Wed, 09 Oct 2002 12:45:20 +0100
On Tue, 8 Oct 2002 15:35:50 -0700, John Mostrom <jmostrom@xxxxxxxxx>
wrote:

>I'm planning on providing an interface on an xsl transformation 
>engine for reusing an xml source by that engine. Here is a mockup of 
>the calls a user might make:
>
>parsedSource ps = transformEngine.getParsedSource( xmlInputStream );
>...
>transformEngine.transform( ps, xslInputStream1, resultOutputStream1 );
>...
>transformEngine.transform( ps, xslInputStream2, resultOutputStream2 );
>...
>transformEngine.transform( ps, xslInputStream2, resultOutputStream3 );
>
>This is a pretty arbitrary example but what I'm trying to illustrate 
>is that a user of our tranformation engine may want to do the xml 
>parsing up front and then reuse that parsed source multiple times.
>
>Thus my dilema: when the transform engine parses the orginal 
>xmlInputStream, should it process any xsl commands "contained" in the 
>xmlInputStream or not?
>
But what document would those commands operate on?  You only have
access to xmlInputStream.

Are you familair with the JAXP interface used by Java based
processors?  That seems to do all the things you are talking about:
assuming the 'ps' in your example is actually a stylesheet, then you
seem to be talking about a templates object.  Perhaps I misunderstand?

There are three parts to an XSLT process:
1. Parsing.  Since XSLT is XML, this is an ordinary XML parse.
2. Compilation.  Checking the XSLT is legal, possibly turning the XML
tree into an internal form for efficient execution.
3. Execution.  Applying the transform to a specific input document.

Its not clear to me which of (1) and (2) you are talking about saving,
but in either case there is no question of executing XSLT commands
because there is no input.

Perhaps instead of code you could show us what the XML files contain?

>>  and have run into a question about what to do when parsing an xml
>>  source that contains xsl instructions.
>>
>>  (By 'contains' I'm including both embedded xsl and PI referenced xsl.)

I am fairly sure the answer is to leave well alone.  Apart from the
points above, there is no guarantee that the output of a
transformation is going to be XML: it could be HTML or text for
example.

The only thing I am absolutely convenced of is that one of us is
confused ;-)

Trevor Nash
--
Traditional training & distance learning,
Consultancy by email

Melvaig Software Engineering Limited
voice:     +44 (0) 1445 771 271 
email:     tcn@xxxxxxxxxxxxx

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread