You're right, just after I sent the question I
realized I was off-topic, my apologies.

Thank you for the 2 solutions though.
I did try #2, evaluate() and it worked nicely.

I will fiddle with the other solution as well to check
out its limitations.

Thanks,  Mike

--- "J.Pietschmann" <[EMAIL PROTECTED]> wrote:
> Mike Kellstrand wrote:
> 
> > I want to be able to pass a node name into a named
> template as a param and
> > then operate on it.  When I try to use the node
> name param in the template,
> > it gets interpreted as a string and not an actual
> node.   i.e.
> >  
> > The snipett:
> > <xsl:variable name="x" select="choice"/>
> > <fo:block>a: <xsl:value-of
> select="choice[1]"/></fo:block>
> > <fo:block>b: <xsl:value-of
> select="concat($x,'[1]')"/></fo:block>
> >  
> > Will generate:
> > a: {the actual xml data in the 1st choice node}
> > b: choice[1]
> 
> That's exactly as it is supposed to work.
> Actually this is an XSLT question, only loosely
> related to
> FOP, and would have better been asked on the XSL
> list:
>   http://www.mulberrytech.com/xsl/xsl-list/
> 
> Anyway: You expect the XSLT processor to perform
> what's called
> double evaluation: first evaluate "concat($x,'[1]')"
> into
> "choice[1]", then evaluate the latter again. That's
> not the
> way XPath expressions are handled.
> 
> > How do I get this to work as intended?
> 
> Commonly, two approaches:
> 1. Use
>    <fo:block>b: <xsl:value-of
> select="*[name()=$x][1]"/></fo:block>
>   Note that this approach works for your specific
> problem but wont
>   help you in more general cases.
> 2. Most XSLT processors have an extension function
> which evaluatess
>   a string as XPath expression, roughly like
>    <fo:block>b: <xsl:value-of
> select="foo:evaluate(concat($x,'[1]'))"/>..
>   The exact function name and the necessary
> namespace are processor
>   specific, check your processor's manual for
> details.
> 
> J.Pietschmann
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to