[4suite] Re: [XML-SIG] xsl:nclude-and-transform

Mike Olson Mike.Olson@fourthought.com
Wed, 18 Jul 2001 14:09:14 -0600


> >
> > Here are the ideas I had so far :
> >
> >      * forget about my own DTD and write company.xml using docbook, then
> >        include an entity. It already works like this, but I need to
> >        make it more flexible...
> >
> >      * generate the document in two steps : replace the above comment with
> >        a specific <include file="company.xml/> tag that gets processed by
> >        a first XSLT and replaced with the proper docbook elements, then
> >        feed the result to the docbook generator. The problem is that when
> >        you generate a document, you have to know which stylesheet to apply
> >        for the first processing step.
> >
> >      * generate the document in a single step : modify the above tag to
> >        specify the stylesheet :
> >          <include file="company.xml" transform="company2docbook.xsl"/>
> >        and use something like an XSL extension function to replace that
> >        include tag with the corresponding elements. That would ask for
> >        docbook XSL customization, but we already do that.
> >
> >      * use processing instructions : I don't know much about PI. Could
> >        I use a PI to do the two-step processing described above by
> >        including a <?PI use-stylesheet='first-step.xsl'?> in the document
> >        that I feed to the docbook processing step ?
> >
> >      * ...

I must be missing the problem statement.  From what I gathered, you want
to insert company.xml into your docbook src, but translate xompany.xml
into docbook before doing so.  Is that correct?

My first inclenation would be to use what you call step 2.  However, I
think you can do this all in XSLT with something like:


<xsl:include href='docbook.xsl'/>
<xsl:include href='company.xsl'/>

<xsl:template match='affiliation'>
  <xsl:variable name='translated'>
    <xsl:apply-templates select='document("company.xsl")'
mode='company-to-docbook'/>
  </xsl:variable>
  <xsl:apply-templates select='ftext:node-set($translated)'/>
</xsl:template>


> >
> > As you understood, I'm missing a <xsl:include-after-transform/> tag...
> >
> > I look forward to your ideas and comments.
> 
> For max flexibility I'm guessing you wan thtis to be transparent to the
> stylesheet.  The best way I could think of makinng this happen would be to add
> an option to the 4XSLT processor for translating xinclude instructions from
> result elements.

I don't follow.  Why would you want to output xinclude, when in a
stylesheet you can just use copy-of and the document function.

> 
> Failing that, and if you don't mind minimal XSLT additions, the best solution
> is probably
> 
> <xsl:template match="affiliation">
>   <xsl:variable name="included">
>     <xsl:value-of select="document('company.xml')"/>
>   </xsl:variable>
>   <xsl:copy>
>     <xsl:copy-of select="$included"/>
>   </xsl:copy>
> </xsl:template>
> 
> Does all this help?

I guess I also don't see how this is less flexible then using XInclude
in the source document.  The only way this is a bit more flexible is
that you could parameterize "company.xml".

Mike

> 
> --
> Uche Ogbuji                               Principal Consultant
> uche.ogbuji@fourthought.com               +1 303 583 9900 x 101
> Fourthought, Inc.                         http://Fourthought.com
> 4735 East Walnut St, Boulder, CO 80301-2537, USA
> XML strategy, XML tools (http://4Suite.org), knowledge management
> 
> _______________________________________________
> 4suite mailing list
> 4suite@lists.fourthought.com
> http://lists.fourthought.com/mailman/listinfo/4suite

-- 
Mike Olson                                Principal Consultant
mike.olson@fourthought.com                +1 303 583 9900 x 102
Fourthought, Inc.                         http://Fourthought.com 
4735 East Walnut St,                      http://4Suite.org
Boulder, CO 80301-2537, USA
XML strategy, XML tools, knowledge management