xsl-list
[Top] [All Lists]

Re: Using a parameter in a select within a recursive template

2004-09-19 00:26:53
Sean & Helen wrote:
         <fo:block><xsl:value-of select="concat('FIELD_',$number)"/></fo:block>
...
However, the output gives me:
FIELD_1 FIELD_2 FIELD_3 etc....

Well, this is exactly what you tell the processor to produce: the
*strings* FIELD_1, FIELD_2 etc.

rather than the data contained within these nodes.

You seem to assume the processor has to interpret the
result of the expression concat('FIELD_',$number) as
an XPath expression again, and act accordingly. This
wont happen just because you find it convenient; the
processor evaluates an expression once and only once.

If you want the processor to select elements with a
constructed name, you have to tell this to the processor
the right way: select all elements, and restrict to elements
which have the name you want. Translated into XPath:
 select="*[name()=concat('FIELD_',$number)]"

I suspect there are ways to simplify your style sheet
drastically.

J.Pietschmann