I do this by using stylesheet parameters that are set with the -PARAM option to
org.apache.xalan.xslt.Process (I like the xalan-1.x behaviour of -PARAM better
since it allows any XPath to be assigned to the parameter, the xalan-2.x
behaviour automatically makes the assigned value a string (such behaviour is
heinous!)).
I think the API function -PARAM calls is setStylesheetParam().
Noel
Rahel Luethy writes:
>for one of the templates i use in the XSL, i'd like to read the XPath
>pattern that's used in the "match"-attribute from the command line...
>just to give you an idea (i know that it doesn't work like this..):
> <xsl:template match=$myXPathPattern>
[where $myXPathPattern was passed in from the command line]
First of all, this is the type of question that gets a better answer
in the XSL-list and the XSL FAQ. Your issue boils down to making the
match pattern be variable, and having the variable be evaluated as an
expression. In the former case, there are some very limited tricks
with predicates. If you need to have a wide-open range of possible
expressions, you should think about a two-stage transformation,
where the first stage produces the stylesheet for the second stage.
More generally, you may want to back away from details and think
about what you're trying to do overall.
.................David Marston
PS: Terminology purists would note that "patterns" aren't part of
XPath, only XSLT. XSLT patterns are derived from "expressions" in
XPath by imposing some restrictions.
This communication is for informational purposes only. It is not intended as
an offer or solicitation for the purchase or sale of any financial instrument
or as an official confirmation of any transaction. All market prices, data
and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made herein
do not necessarily reflect those of J.P. Morgan Chase & Co., its
subsidiaries and affiliates.