This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Strange Parameter Behavior
- From: Greg Faron <gfaron at integretechpub dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Thu, 09 May 2002 15:58:14 -0600
- Subject: Re: [xsl] Strange Parameter Behavior
- Reply-to: xsl-list at lists dot mulberrytech dot com
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>
> <b id="7">
> <c id="8"/>
> <c id="9"/>
> <c id="10"/>
> </b>
> <b id="11">
> <c id="12"/>
> <c id="13"/>
> <c id="14"/>
> </b>
></a>
>
>
>And XSLT of:
>
><xsl:stylesheet version="1.0"
>xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
> <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: http://www.mulberrytech.com/xsl/xsl-list