[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Using parameter in for-each select - newbie questi
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|