Re: [xsl] Strange Parameter Behavior

Subject: Re: [xsl] Strange Parameter Behavior
From: Greg Faron <gfaron@xxxxxxxxxxxxxxxxxx>
Date: Thu, 09 May 2002 15:58:14 -0600
At 03:01 PM 5/9/2002, you wrote:
Given the XML:

<a id="1">
 <b id="2">
   <c id="3"/>
   <c id="4"/>
   <c id="5"/>
   <c id="6"/>
 <b id="7">
   <c id="8"/>
   <c id="9"/>
   <c id="10"/>
 <b id="11">
   <c id="12"/>
   <c id="13"/>
   <c id="14"/>

And XSLT of:

<xsl:stylesheet version="1.0" xmlns:xsl="";>

 <xsl:output encoding="ascii" omit-xml-declaration="yes" indent="yes"/>
 <xsl:strip-space elements="*"/>

<xsl:param name="param-id" select="/a/b/c[1]/@id"/>

I get the results below when I change your stylesheet to only select one "c" element (i.e. select="/a[1]/b[1]/c[1]/@id"). Your original selection chooses the first "c" element of ALL "b" elements of ALL "a" elements (even though a well formed document will only have one "a" element, it may have unlimited "b" elements). I don't know what it's doing from there, but I got the expected result when I added the "indices".

   param-id: 3<br />
   prev: <br />
   next: 4<br />

Greg Faron
Integre Technical Publishing Co.

XSL-List info and archive:

Current Thread