xsl-list
[Top] [All Lists]

Re: [xsl] combining multiple documents

2008-01-27 08:56:28
Steven Ericsson-Zenith wrote:

As far as I am aware templates do not change their behavior because
of an implied context change.

Keys, apparently, do.

  I think the following example should make my point more clear:

    <xsl:stylesheet
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        version="2.0">

       <xsl:output indent="yes"/>

       <xsl:variable name="d1">
          <e a="1"/>
          <e a="2"/>
          <e a="3"/>
       </xsl:variable>

       <xsl:variable name="d2">
          <e a="3"/>
          <e a="2"/>
          <e a="3"/>
       </xsl:variable>

       <xsl:key name="k" match="e" use="@a"/>

       <xsl:template name="t">
          <xsl:param name="a"/>
          <xsl:sequence select="e[(_at_)a eq $a]"/>
       </xsl:template>

       <xsl:template name="initial">
          <result>
             <xsl:for-each select="$d1, $d2">
                <key>
                   <xsl:copy-of select="key('k', '3')"/>
                </key>
                <template>
                   <xsl:call-template name="t">
                      <xsl:with-param name="a" select="'3'"/>
                   </xsl:call-template>
                </template>
             </xsl:for-each>
          </result>
       </xsl:template>

    </xsl:stylesheet>

  Regards,

--drkm






















      
_____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 
http://mail.yahoo.fr


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

<Prev in Thread] Current Thread [Next in Thread>