[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Bruce,
In effect what you're learning is that as you apply templates to one or another node, you sometimes have to "carry your context with you". You are doing this with parameters.
So if your calling a new template switches the context back to the $cite-ref, pass the db:citation context as a parameter as you do so. Then in the cite-ref context, assuming the db:citation is bound to $citation, your test would look like
(See those location paths start from a node bound to a parameter, instead of implicitly from the current node, which has switched.)
This switching back and forth (and the resulting question, "which tree am I on?", which fortunately isn't generally hard to answer) is of the essence of the kind of solution you are designing; once you get the hang of it it's kind of fun.
At 04:02 AM 5/25/2005, you wrote:
Re: [xsl] preceding axis and context switching (was re: configuring conditionals)
Subject: Re: [xsl] preceding axis and context switching (was re: configuring conditionals) From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Wed, 25 May 2005 11:39:43 -0400 |
Bruce,
In effect what you're learning is that as you apply templates to one or another node, you sometimes have to "carry your context with you". You are doing this with parameters.
So if your calling a new template switches the context back to the $cite-ref, pass the db:citation context as a parameter as you do so. Then in the cite-ref context, assuming the db:citation is bound to $citation, your test would look like
count($citation/../db:citation) = 1 and $citation/@linkend = $citation/preceding::db:citation[1]/@linkend
(See those location paths start from a node bound to a parameter, instead of implicitly from the current node, which has switched.)
This switching back and forth (and the resulting question, "which tree am I on?", which fortunately isn't generally hard to answer) is of the essence of the kind of solution you are designing; once you get the hang of it it's kind of fun.
Cheers, Wendell
At 04:02 AM 5/25/2005, you wrote:
Wendell wrote:
At 02:24 PM 5/24/2005, I wrote:So if test="count(../db:citation = 1) and @linkend = preceding::db:citation[1]/@linkend", or something along those lines.
Of course you'll have to fix the typo. (I must be channeling DC. ;-)
Got it. But what if I need to use this is another template, where I again have to switch context to the $cite-ref parameter (as element())? Am not sure how to do that with the preceding axis bit.
Bruce
====================================================================== 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 ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] preceding axis and context sw, Bruce D'Arcus | Thread | Re: [xsl] preceding axis and contex, Bruce D'Arcus |
RE: [xsl] output to two files with , Michael Kay | Date | RE: [xsl] Saxon -> UnknownHostExcep, Michael Kay |
Month |
Keywords