[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Q: XSLT: conversion: string variable to selection pat
At 99/07/13 17:15 -0700, Aaron Fischer wrote: >I am using XSLT; I have a <xsl:param-variable> which is a string. I want >to directly apply this variable's value as my template selection pattern; Then by "template selection pattern" I assume you want <xsl:apply-templates> and not <xsl:template> as was implied by your example. >is there a way to explicitly convert my >string variable into >a reference pattern (i'm not sure what difference there is between the two, >aside from named type) Not "convert" but there is a way to *use* your string variable in a node set expression, which is what is used to select the nodes for processing. The only place to use the string variable is in a predicate, so in order to get the children of the current node named by the variable $mystring, you would use: XSL-19990421: <xsl:apply-templates select="*[qname(.)=$mystring]"/> XSL-19990709: <xsl:apply-templates select="*[name(.)=$mystring]"/> In this way you are selecting all your children (using "*") and then filtering them with the predicate "name(.)=$mystring" to get only those children named by your string variable. I hope this helps. .................. Ken -- G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995) Website: XSL/XML/DSSSL/SGML services, training, libraries, products. Publications: Introduction to XSLT (3rd Edition) ISBN 1-894049-00-4 Next instructor-led training: MS'99 1999-08-16 MT'99 1999-12-05/06 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
|