Subject: Re: [xsl] Nested/embedded/self-referential path expressions. From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Thu, 11 Jul 2002 21:20:08 +0100 |
Hi Ed, > What I want to do is combine the if with the "match=..." clause of > the template. The problem is that I need to reference the "name()" > of the context/element with the "name()" in a different > context/element. The logical expression would be somethink like the > following: > > <xsl:template match="Row/*[/Table/Columns/*[{inner context name}={outer > context name}]]"> > > Can/how do I reference a element/component of the outer context for > comparison in the inner context? You can't. One method you can use in this situation, though, is to define a key that can get you from a name to a column (child of the Columns element): <xsl:key name="columns" match="/Table/Columns/*" use="name()" /> Then you can do: <xsl:template match="Row/*[key('columns', name())]"> ... </xsl:template> In general it's a bad idea to use complicated conditions like this within patterns; you'd probably be better off having a general template for all elements within Row elements, but only applying templates to those that share a name with a column: <xsl:template match="Row"> <xsl:apply-templates select="*[key('columns', name())]" /> </xsl:template> <xsl:template match="Row/*"> ... </xsl:template> Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Nested/embedded/self-referent, Edward L. Knoll | Thread | Re: [xsl] Nested/embedded/self-refe, Edward L. Knoll |
[xsl] XSLT & SQL, E L | Date | Fw: [xsl] XSLT & SQL, E L |
Month |