Re: [xsl] combining multiple documents

Subject: Re: [xsl] combining multiple documents
From: Florent Georges <lists@xxxxxxxxxxxx>
Date: Sun, 27 Jan 2008 16:56:05 +0100 (CET)
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[@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

Current Thread