[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Applying a selection pattern on a note set constructed in the XSL sheet


Subject: Applying a selection pattern on a note set constructed in the XSL sheet
From: "Maxime Levesque" <maximel@xxxxxxxxxxxxxx>
Date: Fri, 16 Jul 1999 11:27:40 -0700




<xsl:template match="TABLE" name="merge_table">

   <xsl:variable name="t">
	<TABLE>
		<TR>
			<TD>B1.1</TD>
			<TD>B1.2</TD>
		</TR>
		<TR>
			<TD>B2.1</TD>
			<TD>B2.2</TD>
		</TR>
	</TABLE>
   </xsl:variable>

  <!-- let's say that we have matched a 4x4 table.
   I'd like to 'merge' it with the table assigned to $t
   by merging i mean concatenating the content
   of every cell of "." with it's corresponding
   cell in $t
  ... ->

   <TABLE>

       <xsl:for-each select="TR">

         <xsl:variable name="i" expr="position()"/>

         <TR>             

             <xsl:for-each select="TD">

                <xsl:variable name="j" expr="position()"/>

                <TD><xsl:value-of select=".">


                    <!-- This is where I either 
                         violate the XSL standard or do something wrong -->

                    <!-- begin heresy ... -->
                    <xsl:value-of select="$t/tr[$i]/td[$j]">
                    <!-- end of heresy ... -->

                </TD>

             </xsl:for-each>
          </TR>
       </xsl:for-each>
   </TABLE>
<xsl:template>




... "merge_table" applyed to :

	<TABLE>
		<TR>
			<TD>A1.1</TD>
			<TD>A1.2</TD>
		</TR>
		<TR>
			<TD>A2.1</TD>
			<TD>A2.2</TD>
		</TR>
	</TABLE>

... would result in :

	<TABLE>
		<TR>
			<TD>A1.1B1.1</TD>
			<TD>A1.2B1.2</TD>
		</TR>
		<TR>
			<TD>A2.1B2.1</TD>
			<TD>A2.2B2.2</TD>
		</TR>
	</TABLE>



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords
xsl