xsl-list
[Top] [All Lists]

RE: in-document references

2003-01-08 04:10:42
What I want to do is to locate the appropriate "define" node-set, and 
have XSLT pretend that the "define" nodeset is in the place of the 
"ref" node. Right now I am using <xsl:apply-templates> to apply the 
templates to the "define" nodeset. But that's not good 
enough, because 
I'd like to be able to treat the anscestors of the "ref" node as the 
ancestors of the "define" nodeset. That would make my 
programming a lot 
easier.

How do I do that?

You're making things much more difficult than they are. Perhaps you have
overlooked that a path expression can start with a variable reference:

<xsl:apply-templates select="define">
  <xsl:with-param name="ref" select="ref"/>
</xsl:apply-templates>

<xsl:template match="define">
  <xsl:param name="ref"/>
  <xsl:value-of select="$ref/ancestor::foo/@bar"/>
</xsl:template>

Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>