xsl-list
[Top] [All Lists]

Re: [xsl] redirecting ouput to a different file?

2011-08-18 20:01:49
At 2011-08-18 17:49 -0700, Dan Vint wrote:
So I can drop that <xsl:result-document href="DMC-{modelic}-{sdc}-{chapnum}-.... into all of my templates?

No ... not all. You build the result tree under <xsl:result-document> that is targeted for that file. <xsl:result-document> just starts the building of a new result tree and you build it just like you build the default result tree when not using that instruction.

I hadn't found any complex examples in my searches, but was hoping it would work like what you describe.

It does work like I describe, but I don't think you see how I'm describing it:

  <xsl:template match="avee">
    <xsl:result-document href="DMC-{modelic}-{sdc}-{chapnum}-....
      <xsl:apply-templates select="..."/>
    </xsl:result-document>
  </xsl:template>

  <xsl:template match="whatever">
    ... some stuff that goes into that result document...
  </xsl:template>

The <xsl:apply-templates/> above will end up building nodes under <xsl:result-document/> even if that building is done from other templates. You mustn't copy the <xsl:result-document> into the other templates.

Once you finish building the tree and you process something after the <xsl:result-document> instruction, the tree is done with and the file is written (though likely it was being written along the way).

BTW, you can nest the instructions in order to create a separate file on the side while you are in the middle of creating another file. You just cannot re-open an <xsl:result-document/> file and add to it.

I hope this clarifies things for you.

. . . . . . . . . Ken

--
Contact us for world-wide XML consulting & instructor-led training
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
G. Ken Holman                 mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--