Subject: Re: [xsl] variable question From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Sun, 29 Aug 2004 10:16:12 +0100 |
Hi Bruce, > Is there some obvious reason why the "title-before" variable below > doesn't work when called from within a template? It depends on what you mean by "doesn't work". Does it give you an error, give you no output, or give you output that you don't expect? You haven't shown how the variable is "called" from within the template, and I'm not sure whether these variable declarations are global or declared within the template itself. Without this information, it's hard to debug. > I'm not sure if the problem is that there's something wrong with the > way I'm trying to use variables, or something about the context and > the xpath expressions (my guess is the latter). Well, there's: > <xsl:when test="not[mods:relatedItem[@type='host']]"> Which should presumably be: not(mods:relatedItem[@type = 'host']) ^ ^ Unless you have some <not> elements that might have mods:relatedItem children, which I'm guessing you don't. Aside from that, the $reftype variable will only be set to what you expect if the <mods:relatedItem> elements are children of the current node at the point the $reftype variable is declared. It almost certainly won't work if these variables are declared globally, for example, since in that case the current node is the root node (and I don't think the <mods:relatedItem> elements are document elements). You could set the $title-before variable with: <xsl:variable name="title-before"> <xsl:if test="$reftype = 'chapter'"></xsl:if </xsl:variable> and it would do the same thing. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] variable question, Bruce D'Arcus | Thread | RE: [xsl] variable question, Michael Kay |
Re: [xsl] find out if my parent is , Jeni Tennison | Date | Re: [xsl] word2html.xsl (was Conver, Oleg Tkachenko |
Month |