[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: xsl:include, paramterizable?
Joel, >I would like to dynamically specify attribute sets (defined >in different xsl files) to include. > >So I thought I'd do something like: > ><xsl:variable name"styles">defaultstyles.xsl</xsl:variable> > ><xsl:include href="<xsl:value-of select={$styles}>"/> > >But, that didn't work (not terribly surprising). > >Nor did: ><xsl:include href=<xsl:value-of select="{$style}"/>/> There are about three gaps in your understanding to tackle before looking at how to dynamically specify attribute sets. The first is to understand what a well-formed XML document looks like. XSLT stylesheets have to be well-formed XML documents. You cannot have elements as attribute values; the thing that is giving you the error with your statements is the XML parser, not the XSLT processor. The second minor thing is to point out that you don't have to rely on double quotes (") all the time: you can use single ones (') as well - alternate between them when you want to quote something within quotes. Attribute values always have to be quoted. The third is to understand that the 'select' attribute on the xsl:value-of element takes an XPath expression as a value. That means that you shouldn't place the XPath within {...}. The {...} syntax indicates the use of an attribute value template - this is used when the XSLT processor is expecting a literal value for an attribute on a literal result element, but you want it to compute it instead. However, to answer your question: I'm afraid you cannot dynamically include a stylesheet in another stylesheet. To work within this, perhaps you could try specifying multiple attribute sets and dynamically choosing which attribute set to use on a particular element. Alternatively, since the names and values of the attributes in an attribute set are interpreted as attribute value templates (i.e. you can put an XPath in {...} to give dynamic names and values), you could try that approach. If you would like a more concrete suggestion, then I recommend posting more details of the transformation you want to make. I hope this helps anyway, Jeni Dr Jeni Tennison Epistemics Ltd * Strelley Hall * Nottingham * NG8 6PE tel: 0115 906 1301 * fax: 0115 906 1304 * email: jeni.tennison@xxxxxxxxxxxxxxxx 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
|