Subject: Re: [xsl] Using parameter in for-each select - newbie question From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Mon, 26 Mar 2001 16:15:17 +0100 |
Hi Chris, > <xsl:for-each select="//$table"> > <xsl:call-template name="create-csv"/> > </xsl:for-each> Variables aren't text macros - you can't use a variable reference to insert some text into an XPath. Basically, this is illegal XPath expression syntax, which is why you're getting the error. You're aiming here for a dynamic XPath to pick the elements that you want. Rather than trying to construct the XPath dynamically, you can pick all the elements and filter them (using a predicate) to choose only those whose name is the same as the value of the $table parameter, i.e.: //*[local-name() = $table] If you start having $table hold more sophisticated XPaths than just the name of an element, then you may have to use an extension function that gives dynamic evaluation of strings as XPaths, such as saxon:evaluate(): saxon:evaluate(concat('//', $table)) I don't know of an equivalent extension function in xt, I'm afraid. I hope that helps, 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] Using parameter in for-each s, Chris Theisen | Thread | [xsl] Fetching record fromn Databas, msujit |
Re: [xsl] specifying a target for a, Jeni Tennison | Date | Re: [xsl] Data Leakage, Jeni Tennison |
Month |