Subject: Re: [xsl] xpath dynamic selection From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Sun, 11 Jul 2004 13:57:39 +0100 |
Hi Wim, > Ok, I'll clearify my vague question with some real code. But it is rather > long. OK. There are multiple problems with your code, some of which may be related to your question and some of which may not be. I'm not going to debug all of it, since some of the problems may have arisen due to your cutting down your code. But to help you debug it, if you're getting errors: 1. The <xsl:apply-templates> instruction takes a select attribute, not a match attribute. 2. Parameter declarations should be the very first things in a template: they shouldn't have any instructions or literal result elements or text before them. 3. When you're in a template that matches <alternativecourses> elements, then the expression "alternativecourses/alternative" will not select any nodes; you need the path "alternative" to select the <alternative> element children of the current <alternativecourses> element. 4. The path: ancestor::../../*/alt[@number=current()/@number] is not a valid path. The ".." is a shorthand for "parent::node()" so this expands to: ancestor::parent::node()/parent::node()/child::*/child::alt[attribute::number=current()/attribute::number] This isn't legal because the first step has two axes in it. I think that you want: ancestor::usecase/*/alt[@number = current()/@number] if you want to select the <alt> element whose number attribute has the same value as the number attribute of the current <alternative> element. 5. The <alternative> elements in your example do not have number attributes, and nor do the <alt> elements, so trying to select <alt> elements whose number attributes have the same value as the number attribute of the current <alternative> element is not going to work. I still can't work out what you want here. If you want the value of the <alt> element whose value is $number then that's the same as just using $number. Are you sure that you don't just want: <xsl:param name="start" select="$number" /> If not, then can you try explaining how $start needs to be calculated, and perhaps we can then help you put together the code you need to calculate it. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xpath dynamic selection, Wim Lemkens | Thread | Re: [xsl] xpath dynamic selection, Wim Lemkens |
Re: [xsl] xpath dynamic selection, Wim Lemkens | Date | Re: [xsl] xpath dynamic selection, Wim Lemkens |
Month |