Phil, you may try:
<xsl:value-of select="/root/thing/*[name(.)=$selector]"/> Best regards, --------------------------------------------- Luca Morandini GIS Consultant [EMAIL PROTECTED] http://utenti.tripod.it/lmorandini/index.html --------------------------------------------- > -----Original Message----- > From: Phil Blake [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 31, 2002 3:39 AM > To: [EMAIL PROTECTED] > Subject: Selecting nodes based on variables > > > Hi everyone, > > 1. I have a simple xml doc: > > <root> > <thing> > <title>Jelly</title> > <wobblyness>high</wobblyness> > </thing> > <thing> > <title>Brick</title> > <wobblyness>low</wobblyness> > </thing> > </root> > > 2. Within a stylesheet I have a variable: > > <xsl:variable name="selector" value="'title'/> > > 3. I want to select the XML tag with the name in the variable $selector > > For example the XPath: > > /root/thing/$selector > needs to translate to: > /root/thing/title > > Then, if I change the value of $selector: > > <xsl:variable name="selector" value="'wobblyness'/> > > then the path > > /root/thing/$selector > would translate to > /root/thing/wobblyness > > The Problem: I can't figure how to do this kind of de-referencing. Does > anyone have an example or have I missed a very obvious point? > > Thanks in advance, > > Phil > > > --------------------------------------------------------------------- > Please check that your question has not already been answered in the > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> > > To unsubscribe, e-mail: <[EMAIL PROTECTED]> > For additional commands, e-mail: <[EMAIL PROTECTED]> > --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>