Subject: Re: [xsl] Generating "nested" Result Documents From Flat Source From: Eliot Kimber <ekimber@xxxxxxxxxxxx> Date: Mon, 4 Oct 2010 16:07:33 -0500 |
I think I answer my own question: I generate "myns:result-document" elements from my main processing and then in my root template I process those elements to generate result documents using the information on the myns:result-document elements and everything is as I want it. Cheers, E. On 10/4/10 3:53 PM, "Eliot Kimber" <ekimber@xxxxxxxxxxxx> wrote: > I have a transform that converts Word docs into sets of result documents. My > general technique is to pre-process the Word into a sequence of elements > annotated with the effective result level, defining the result hierarchy the > elements should generate. > > Given this I can then use for-each-group group-starting-with to translate > the flat list into the appropriate hierarchy via essentially recursive > descent (that is, each level applies processing for the next level down to > the current group in the for-each). > > However, I'm running into a problem when I have the case where a group at > level 1 and a group at level 2 both need to generate result documents. > > So for example, I might have this Word input: > > Heading 1 > Normal > Heading 2 > Normal > Heading 1 > Normal > > Where the desired result is three result documents, one for the first > Heading 1 paragraph and the Normal paragraph following it, one for the > Heading 2 and its following para and one for the last Heading 1. > > In addition, I currently have the code written to apply at least two passes > of processing over the elements that will eventually be put into a document, > e.g.: > > <xsl:variable name="resultDoc"> > <xsl:apply-templates select="current-group()" mode="pass-one"/> > </xsl:variable> > > <xsl:result-document href="..."> > <xsl:apply-templates select="$resultDoc" mode="pass-two"/> > </xsl:result-document> > > This works fine for one level of output (that is, a single result document > generated by highest group). > > But if I have a nested group that also needs a result document as in the > example above then I get the failure "Cannot switch to a final result > destination while writing a temporary tree" which I guess makes sense (or at > least I accept that there must be a good reason for this restriction). This > is because the processing happening in mode "pass-one" may hit the part > shown above, meaning the processor is currently in the process of > constructing the value of "resultDoc" for the higher-level group. > > I've puzzled over this problem and I'm not seeing an obvious solution but I > suspect that there's some relatively simple approach that would allow me to > generate multiple result documents. > > The only thing that I've thought of so far is to have the main processing > logic generate a sequence of elements that I can process serially to > generate the required result documents. > > Am I missing some non-obvious algorithm? > > Thanks, > > Eliot > > -- > Eliot Kimber > Senior Solutions Architect > "Bringing Strategy, Content, and Technology Together" > Main: 512.554.9368 > www.reallysi.com > www.rsuitecms.com > -- Eliot Kimber Senior Solutions Architect "Bringing Strategy, Content, and Technology Together" Main: 512.554.9368 www.reallysi.com www.rsuitecms.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Generating "nested" Result Do, Eliot Kimber | Thread | Re: [xsl] Generating "nested" Resul, Christopher R. Maden |
[xsl] Generating "nested" Result Do, Eliot Kimber | Date | Re: [xsl] dateTime conversion, David Carlisle |
Month |