[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Evaluating XSLT Expressions At Run-Time


Subject: RE: [xsl] Evaluating XSLT Expressions At Run-Time
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Fri, 9 Jan 2004 10:02:23 -0000

If the expression is simply a node-name, then you can do

select="*[name()=$param]"

For more complex expressions, you need the xx:evaluate() extension
function.

Michael Kay

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Schwartz, Rechell R, ALABS
> Sent: 09 January 2004 07:27
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Evaluating XSLT Expressions At Run-Time
> 
> 
> All,
> 
> I was wondering if there was a way to evaluate XSLT Expressions at
> run-time without resorting to using extensions. Specifically, 
> what I am
> trying to do is as follows (this is a simplified version to ease the
> explanation). I have 2 XML documents: one that has my real 
> XML data and
> a second document that specifies the node names that are identified in
> my first document. Depending upon what node name is read from 
> the second
> document, I want the string value of that node name to be used in the
> line <xsl:apply-templates select="$Node_Name" />, so that a different
> template is called depending upon what the string value of  $Node_Name
> evaluates to. Any help would be greatly appreciated.
> 
> <xsl:template match="ElementFromFirstXMLDoc">
> <xsl:variable name="Data" select="document('doc2.xml')/Data" />
>  <xsl:for-each select="$Data/Node">
> <xsl:variable name="Node_Name" select="NodeName" />
> <xsl:apply-templates select="$Node_Name" />
> </xsl:template>
> 
> Thanks,
> Rechell Schwartz
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


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



Current Thread
Keywords