xsl-list
[Top] [All Lists]

RE: xsl:param xsl:copy-of

2003-04-15 00:36:38
Hi,

If I have a structure like - 

<xxx>
<a>
<b>
<c>
</xxx>

in a vairiable X1 can I do the follwing -

<xsl:call-template>
<xsl:with-param name="X1" select="$X1(not(position() =
1))" />
</xsl:call-template>

to get -

<xxx>
<b>
<c>
</xxx>

for the next iteration?

Unless you use exslt:node-set or XSLT 1.1/2.0, you can't modify the node-set. 
You should consider passing the node-set $X1 as such, and have another 
parameter to define the index of the containing element to be processed, i.e.

<xsl:template name="foo">
  <xsl:param name="X1" select="/.." />
  <xsl:param name="index" select="1" />

  <xsl:if test="$i &lt;= count($X1/*)">
    <xsl:for-each select="$X1/*[position() = $index]">
      ...
    </xsl:for-each>
    <xsl:call-template name="foo">
      <xsl:with-param name="X1" select="$X1" />
      <xsl:with-param name="index" select="$index + 1" />
    </xsl:call-template>
  </xsl:if>
</xsl:template>

Or you can pass

  <a />
  <b />
  <c />

(no wrapper element) and when recursing, pass if forwars with 
select="$X1[not(position() = 1)]". Did that make any sense to you?

Cheers,

Jarno - VNV Nation: Fallout


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



<Prev in Thread] Current Thread [Next in Thread>