[Home] [By Thread] [By Date] [Recent Entries]
Robert,
You say you need to pass a parameter, but you don't say why, and as others have said, the problem you present would be more easily solved more directly. (Maybe you need to use a parameter for some other reason that we haven't seen yet.) Either your path is determined relative to the anchor element that generates the link, or it is determined absolutely. (Or it should be determined some other way you haven't elucidated.) If it is to be determined relative to the anchor, Andrew's solution will work:
Given your data, you'd probably want to say
href="{ancestor::para/docBase}/{@href}" to construct a complete file
reference.If the path is to be determined absolutely (once
for the document, in one place), you could either
query directly, as in
href="{/content/para/docBase}/{@href}", or
better, bind "/content/para/docBase" to a global
variable and then reference that, as in
href="{$docpath}/{@href}". David suggested this yesterday.Contributors to this list are pretty good at reading between the lines and guessing what you actually need to know. But we still don't know if this actually gives you what you need, partly because of the parameter red herring (if it is a red herring). XPath was designed precisely to allow you to crawl around the tree reaching for data, without having to pass that data around through your templates. It's true that templates are like functions, but the input available to those functions (defined by the processing context of any template) is much wider (and more complex) than simply the parameters (arguments) you pass them, since the entire input tree plus anything you happen to have bound to variables in scope is always available. So mostly we don't have to use parameters explicitly. When any template is executed, it knows: what node in the tree was matched (the context node) (and implicitly, everything else in the input tree querying it either absolutely or relative to this node) how many nodes were selected when this one was selected (the context size) which one of the set this is (the context position) all the variables and parameters in scope (and implicitly, anything that can be derived from them) all the XPath/XSLT functions and operators (including extensions in scope) One of the interesting things about XSLT as a functional language is that all this info means that we don't generally need to pass parameters explicitly since "context" (a magic word in XSLT) tells us everything we need. Parameters get really useful when things get fancy, but it isn't clear you're at that point. Cheers, Wendell At 02:41 AM 4/12/2006, you wrote: Hi, ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
|

Cart



