[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: 2 problems with variables(include & frame)

Subject: Re: 2 problems with variables(include & frame)
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 30 Apr 2002 11:20:58 +0100
include frame in jsp

> (I'm using XALAN-XERCES)
> ...
> <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

> ....
> <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 &amp;. XSLT stylesheets must be
well-formed XML documents. So you need to use:

<frame .....   src="/dir/myfile.jsp?lang={$lang}&amp;grp={$grp}"/>



Jeni Tennison

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.