|
Subject: Re: [xsl] Generating a list of items NOT present in source XML From: Greg Faron <gfaron@xxxxxxxxxxxxxxxxxx> Date: Fri, 17 May 2002 16:27:49 -0600 |
<xsl:with-param name="count" select="count + 1" />
[ Just for those following this thread (and later in the archives), the above line (and others like it) should probably read as <xsl:with-param name="count" select="$count + 1" /> Note the dollar-sign before 'count'. Without it, you will have an infinite recursion. ]
-->
<xsl:template name="show-missing">
<xsl:param name="nodes" select="/.."/>
<xsl:param name="start-number" select="1"/>
<xsl:param name="end-number" select="1"/>
<xsl:param name="index"/>
<xsl:if test="$nodes and $index and ($end-number >= $start-number)">
<xsl:choose>
<!-- For each of these tests, instead of comparing against
$nodes[1], I would like to compare against
$nodes[1]/($index converted to XPath path)/. -->
<xsl:when test="$start-number > $nodes[1]">
<xsl:call-template name="show-missing">
<xsl:with-param name="nodes" select="$nodes[position() > 1]"/>
<xsl:with-param name="start-number" select="$start-number"/>
<xsl:with-param name="end-number" select="$end-number"/>
<xsl:with-param name="index" select="$index"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$start-number = $nodes[1]">
<xsl:call-template name="show-missing">
<xsl:with-param name="nodes" select="$nodes[position() > 1]"/>
<xsl:with-param name="start-number" select="$start-number + 1"/>
<xsl:with-param name="end-number" select="$end-number"/>
<xsl:with-param name="index" select="$index"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<obj>
<childnode>
<xsl:value-of select="$start-number"/>
</childnode>
</obj>
<xsl:call-template name="show-missing">
<xsl:with-param name="nodes" select="$nodes"/>
<xsl:with-param name="start-number" select="$start-number + 1"/>
<xsl:with-param name="end-number" select="$end-number"/>
<xsl:with-param name="index" select="$index"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Greg Faron Integre Technical Publishing Co.
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Generating a list of item, Jeni Tennison | Thread | Re: [xsl] Generating a list of item, Jeni Tennison |
| [xsl] Okay, so you can't do dynamic, Michael Peet | Date | Re: [xsl] Okay, so you can't do dyn, Jeni Tennison |
| Month |