[xsl] passing a relative select expression as parameter to stylesheet

Subject: [xsl] passing a relative select expression as parameter to stylesheet
From: Lauren Blau Halverson <lauren_halverson@xxxxxxx>
Date: Mon, 19 Mar 2001 14:29:32 -0500
(using xalan-j1.2)

we are applying our stylesheet from within java code.

based on queries from the user, our application determines an
appropriate set of select expressions to apply to various types of
elements. These expressions are relative the element (for example, for
the element PERSON the select expression might be "name | desc |
@nationality").

We would like to be able to pass these in as parameters to a stylesheet.
(so for this example, one of the stylesheet parameters would be
<xsl:param name="PERSONexp"/>)

Then we would like to evaluate these expressions when in the context of
the template that processes the element. (example <xsl:template
match="PERSON"> <xsl:apply-templates
select="$PERSONexp"/></xsl:template>).

When we pass these in, we appear to have 2 choices.
1. we can pass them as an expression. In this case, it appears that the
expression is being evaluated against the root node of the document and
returning an emptynodelist.

2. we can pass them in as strings. In this case, the select fails with
an error because the value is a String.

So I have 2 questions. In situation 1, is there a way to delay this
evaluation until we are in the appropriate context? In situation 2, can
we somehow apply this string as if it were an expression?

Thanks,
lauren

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


Current Thread