xsl-list
[Top] [All Lists]

Re: [xsl] combining multiple documents

2008-01-25 09:41:40



                <!-- But actually we wanted to pass the extra for use  
here in the second instance of "document" -->

If you want to pass that. then pass it as a parameter.


      <xsl:apply-templates
                    select="doc(@file)"/>

don't do that, do this

      <xsl:apply-templates
                    select="doc(@file)/document">
                    <xsl:with-param name="extra"
                    select="key('extra','introduction')"/>
     </xsl:apply-templates>

aand declare this as a parameter to /document (rather than /, hence teh
change in the select above)



   <xsl:template
        match="/document">
   <xsl:param name="extra" select="()"/>


then you can use <xsl:apply-templates select"$extra"/>

wherever you need to use it.


couple of unrelated points

    <xsl:template
        match="/document">
        <xsl:choose>


It's usually simpler to rewrite a template that just consistes of an
xsl:choose as separate templates.

   <xsl:for-each
                    select="key('extra','introduction')">
                    <xsl:apply-templates
                        select="child::node()"/>
    </xsl:for-each>

could more simply be written as

  <xsl:apply-templates  select="key('extra','introduction')/node()"/>

David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

--~------------------------------------------------------------------
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>
--~--