[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Convert paramter to a sequence

Subject: Re: Convert paramter to a sequence
From: Colin Paul Adams <colin@xxxxxxxxxxxxxxxxxx>
Date: 17 Feb 2006 11:57:46 +0000
convert passing in parameters
>>>>> "Michael" == Michael Kay <mike@xxxxxxxxxxxx> writes:

    >> > Pass the parameter as the Xpath value "(1, 2, 3)".
    >> 
    >> If the system allows xpath expressions to be specified
    >> externally.  Unless I've missed something, saxon (for example)
    >> only allows (on the command line) parameters to be specified by
    >> a string value or be specified as a document node by passing in
    >> a file name/uri.

    Michael> Yes. Some products allow you to specify an XPath
    Michael> expression as the parameter value. With Saxon you always
    Michael> pass a value, not an expression.

I too always pass a value, not an expression.
But I get round this for passing XPath parameter expressions from the
command line by converting them to a value first.

I do this by:

1) Saving the static context of the xsl:tranform/stylesheet element of
   the principal stylesheet module in the executable stylesheet. I can
   then use this to parse the parameter into a parsed XPath
   expression.
2) I create a dynamic context based on the initial context node and
   evaluate the expression using that context.
3) The resulting value is then set as the parameter.

The sharp-eyed amongst you will notice that there is no initial
context node if only an initial template is requested. In this case I
disallow XPath expression strings as parameters.
But in fact passing (1,2,3) as a parameter is quite likely to be of
great use in just such a scenario. So one day I intend to remove this
limitation. It should be fairly easy - I just have no time right now.

I think Saxon could easily be adapted to use such a scheme.
-- 
Colin Adams
Preston Lancashire

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.