You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Vl...@bmo.com on 2002/06/20 00:19:21 UTC

Re: Possible to parameterize ?

> Mark Modrall writes:
> >I've been toying with some stylesheets and i was thinking it would be
> >very nice to be able to pass in a parameter to control what the output
> >encoding of a transform would be, but i can't seem to get it to work...
> >Is this prohibited?
> 
> Yes, at least in XSLT 1.0. This is also one of the frequently-asked of
> FAQs about XSLT. (There is a FAQ at www.dpawson.co.uk.)
> 
> The usual workaround is to select a stylesheet from among a set that
> are identical except for their xsl:output statement and any related
> attributes. You can use xsl:include to share common code across the
> set. Select the stylesheet when you invoke Xalan, whether from the
> command line or via API.
> .................David Marston
> 

Hi all,

I would like to use a variable in my xsl:output to store a part of DTD 
URL.

for example:
<xsl:stylesheet version="1.1" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:variable name="dtd" select="'http://hostname:8000/uri'"/>
        <xsl:output doctype-system='{$dtd}/filename1.dtd'/>
        <xsl:template match="/">
                <MyXml dtd="{$dtd}">
                        <xsl:value-of select="$dtd"/>
                </MyXml>
        </xsl:template>
</xsl:stylesheet>

transforms into:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE MyXml SYSTEM "{$dtd}dtdname1.dtd">
<MyXml dtd="http://hostname:8000/uri/">http://hostname:8000/uri/</MyXml>

Is there a workaround for this problem?
A while ago somebody suggested to use Xalan's "evaluate" extension 
function for this purpose - is this feasible?

vlad
(please CC to my address - i'm not subscribed to the list)