You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by greg keraunen <gk...@valinux.com> on 2000/07/08 00:00:26 UTC

xsl_include href="$include_file" - doesn't evaluate parameters

Is this a bug or a feature?
The normal param usage, <xsl:value-of select="$param_name"/>  doesn't
seem to apply for assigning values to attributes inside the xsl:include
element.

Code:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:h="http://www.w3.org/TR/REC-html40">

<xsl:output indent="yes"/>

<xsl:param name="include_file">/home/greg/xslt/test1.xsl</xsl:param>

<xsl:include href="$include_file" />

</xsl:stylesheet>

Gives the following error:
XSLT: File "file:/home/greg/xslt/$include_file" not
found.                                                                                                                                                                           

As you can see, $include_file is being taken literally as the value of
the url rather than evaluating the parameter first.

I'm using:
VA Linux-supplied Red Hat 6.2
jdk118_v1-glibc-2.1.2
xalan-j_1_0_1

-- 
greg keraunen <gk...@valinux.com> 408-542-8600 x8085
web software engineer

Re: xsl_include href="$include_file" - doesn't evaluate parameters

Posted by Andreas Junghans <an...@isb-ka.de>.
Hi Greg,

greg keraunen wrote:
> Is this a bug or a feature?
> The normal param usage, <xsl:value-of select="$param_name"/>  doesn't
> seem to apply for assigning values to attributes inside the xsl:include
> element.

In another posting (which foolish me deleted already) you said it's just
for the purpose of not hard-coding the filename in several stylesheets.
Why not use "good old" XML external entites for that purpose?

Example:

-- file "sheet.xsl"

<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [
 <!ENTITY % common SYSTEM "common.ent">
 %common;
]>
<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
    <xsl:include href="&filename;"/>
</xsl:stylesheet>

-- file "common.ent"

<!ENTITY filename "somefile.xsl">


This way you can put everything that should be shared between your
stylesheets in "common.ent".

Regards

  Andreas

-- 
ISB GmbH                  Phone ++49 721 82800-40 or -0
Karlstraße 52-54          Fax   ++49 721 82800-82
76133 Karlsruhe           mailto:andreas.junghans@isb-ka.de
Germany                   http://www.isb-ka.de