SV: [xsl] Combining 2 template matches

Subject: SV: [xsl] Combining 2 template matches
From: "Per Osnes" <per.osnes@xxxxxx>
Date: Wed, 25 Oct 2006 09:58:14 +0200
Try replacing "foo" with
<xsl:apply-templates mode="inner" select="following-sibling::navigation"/>
and add mode for the second template:
<xsl:template match="navigation" mode="inner">
(The last "apply-templates" with param name="type" select="'tab'" does not
produce anything, but this is probably outside scope of your question.)

 - Per.

 

-----Opprinnelig melding-----
Fra: Aaron Johnson [mailto:artpunx@xxxxxxxxx] 
Sendt: 24. oktober 2006 19:57
Til: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Emne: [xsl] Combining 2 template matches

Hello...

I have a stylesheet that contains two template matches which outputs
the results to two tables in html. I would like to combine the two so
that I only have one table, with the output of the second template
match appearing in the table cell marked "foo" thus rendering the
second template / table redundant. I have tried replacing "foo" with a
named template, but it didn't work.

Any advice would be really appreciated.

xml...

<header/>
       <navigation>
               <focusedTab unremovable="true" immutable="true" ID="38"
name="Home"/>
               <inactiveTab unremovable="true" immutable="true"
ID="36" name="myDetails"/>
               <inactiveTab unremovable="true" immutable="true"
ID="37" name="myMarks"/>
               <inactiveTab unremovable="true" immutable="true"
ID="40" name="myEmail"/>
               <inactiveTab unremovable="true" immutable="true"
ID="40" name="myTimetable"/>
               <inactiveTab unremovable="true" immutable="true" ID="41"
name="Submit Coursework"/>
       </navigation>

...and xsl...

<xsl:template match="header">
<a name="uweTop" id="uweTop"></a>
<table class="headerNavigation" width="100%" border="0"
cellpadding="0" cellspacing="0">
<tr>
       <td>
               <!-- Header: This contains the myUWE logo and controls
for logout etc -->
               <xsl:call-template name="headerTable"/>
               <!-- Header: Ends -->
       </td>
       <td align="right"><img src="{$mediaPathSkin}/transparent.gif"
width="10" alt="" /></td>
       </tr>
       <tr>
               <td>"foo"</td>
       </tr>
       </table>
</xsl:template>

<xsl:template match="navigation">
<table class="headerNavigation" cellspacing="0" cellpadding="0"
border="0" width="100%">
<tr>
       <td>
       <table class="headerNavigation" border="0" cellspacing="0"
cellpadding="0" width="100%">   <tr>
       <xsl:apply-templates>
               <xsl:with-param name="type" select="'tab'"/>
       </xsl:apply-templates>
</tr>
       </table>
       </td>
</tr>
</table>

my attempt...

<xsl:template name="test" match="navigation">
       <table class="headerNavigation" border="0" cellspacing="0"
cellpadding="0" width="100%">
               <tr>
                       <xsl:apply-templates>
                               <xsl:with-param name="type" select="'tab'"/>
                       </xsl:apply-templates>
               </tr>
       </table>
</xsl:template>

Current Thread