RE: [xsl] outputting to original destination from within a result-document

Subject: RE: [xsl] outputting to original destination from within a result-document
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 21 Jun 2006 09:19:22 +0100
> I am using <xsl:result-document> in my stylesheet (processing 
> with Saxon 8.7). I'd like to output back to my original 
> output document from within the <xsl:result-document>. Does 
> anyone know of any way to do this? 

You can't (any more than you can write attributes to a parent element while
writing a descendant. The output model is strictly hierarchic - it can be
helpful to think of the secondary documents as being extensions of the main
output tree, that just happen to be serialized to a different file.

You have to follow the same principle as with a single output file -
structure the processing logic according to the hierarchic structure of the
output to be produced.

Michael Kay

Right now, I'm assuming 
> I'll just have to do post processing with a second 
> stylesheet, but I thought I'd post to see if anyone has any 
> good ideas.
> My stylesheet is converting a single monolithic XML file to a 
> DITA map file and also chunking out the content into separate 
> DITA topic files (using <xsl:result-document>). This is a 
> fine approach, but it doesn't handle nested sections in my 
> monolithic XML file. When I get to a nested section (when I'm 
> inside the <xsl:result-document>), I need to create another 
> topic (new result document), but I also need to add a nested 
> <topicref> to the DITA map file (original output document). I 
> was trying to do this in a single XSL (creating the map file 
> and doing the chunking), but now I think I need to fall back 
> to two separate stylesheets; one to create the map and one to 
> do the topic chunking.
> Can anyone answer my first question or have any other suggestions?
> Thanks for any and all responses,
> Jeff Rosler

Current Thread