[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: 2 problems with variables(include & frame)
Hi, > (I'm using XALAN-XERCES) > FIRST: > ... > <xsl:param name="lang"/> > <xsl:include href="/dir/myfile{@lang}.xsl"/> <!-- myfileen.xsl , > myfilefr.xsl , myfileit.xsl , etc --> > > --> {@lang} (and {$lang} too) doesn't work , '{' not allowed if I > try <xsl:if test=....> , it appears not allowed in this position of > the style-sheet Attribute value templates -- expressions held in {}s -- are only allowed in certain places within an XSLT stylesheet. Those places are the attributes on literal result elements (such as in your second example) and *some* attributes on XSLT elements, but only those that hold literal values, such as the 'data-type' attribute on xsl:sort. You can't use attribute value templates in any attribute that holds an expression (such as the test attribute of xsl:if), or a name, or in the href attribute of xsl:include or xsl:import. You cannot conditionally include or import another stylesheet module in XSLT. Instead, what you should do is have a two stage process where the first stage creates, through some mechanism, the stylesheet that you want to use for the actual transformation. You can create the stylesheet in several ways. One is to use another stylesheet -- create some XSLT to create the XSLT that you want. Another is to write code that reads in the basic XSLT stylesheet, and alters the value of the href attribute of the xsl:include during that read (if you're using SAX) or after the stylesheet has been read in (using DOM), then pass that revised stylesheet on to the transformation. > SECOND: > .... > <frame ..... src="/dir/myfile.jsp?lang={$lang}&grp={$grp}"/> > > --> 'lang={$lang}' works , but '&' not allowed (escape character?) According to the basic XML well-formedness rules, an ampersand character must always be escaped with &. XSLT stylesheets must be well-formed XML documents. So you need to use: <frame ..... src="/dir/myfile.jsp?lang={$lang}&grp={$grp}"/> Cheers, 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
|