[Home] [By Thread] [By Date] [Recent Entries]
Hello John,
> <xsl:for-each select="$dbdef">
> <xsl:if test="key('dbdef-cols', $dbcolumn)">
> <xsl:value-of select="$dbcolumn"/>
> <xsl:if test="$p < $l">
> <xsl:text>, </xsl:text>
> </xsl:if>
> </xsl:if>
> </xsl:for-each>instead of the for-each + if you can write one for-each with predicate: <xsl:for-each select="$dbdef[key('dbdef-cols', $dbcolumn)]"> Now the correct nodeset is selected and position() and last() will work. But they must refer to the inner for-each, so you can't use $p and $l, but <xsl:if test="position() != last()">. So, you have then <xsl:for-each select="$dbdef[key('dbdef-cols', $dbcolumn)]">
<xsl:value-of select="$dbcolumn"/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>Regards, Joerg John Sands schrieb: I have some XSLT that builds a SQL select statement from several input documents. Here's a fragment that builds the column list by getting each distinct column name from a separate file ($pbsdef) and checking that is is defined in another file (referenced by variable $dbdef). XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|

Cart



